Stroke object

 < Day Day Up > 

Availability

Flash MX 2004.

Description

The Stroke object contains all the settings for a stroke, including the custom settings. This object represents the information contained in the Property inspector. Using the Stroke object together with the document.setCustomStroke() method, you can change the stroke settings for the Tools panel, the Property inspector, and the current selection. You can also get the stroke settings of the Tools panel and Property inspector, or of the current selection, by using the document.getCustomStroke() method.

This object always has the following four properties: style, thickness, color, and breakAtCorners. Other properties can be set, depending on the value of the stroke.style property.

Property summary for the Stroke object

The following properties are available for the Stroke object:

Property

Description

stroke.breakAtCorners

Same as the Sharp Corners setting in the custom Stroke Style dialog box.

stroke.capType

A string that specifies the type of cap for the stroke.

stroke.color

A string, hexadecimal value, or integer that represents the stroke color.

stroke.curve

A string that specifies type of hatching for the stroke.

stroke.dash1

An integer that specifies the lengths of the solid part of a dashed line.

stroke.dash2

An integer that specifies the lengths of the blank part of a dashed line.

stroke.density

A string that specifies the density of a stippled line.

stroke.dotSize

A string that specifies the dot size of a stippled line.

stroke.dotSpace

An integer that specifies the spacing between dots in a dotted line.

stroke.hatchThickness

A string that specifies the thickness of a hatch line.

stroke.jiggle

A string that specifies the jiggle property of a hatched line.

stroke.joinType

A string that specifies the type of join for the stroke.

stroke.length

A string that specifies the length of a hatch line.

stroke.miterLimit

A float value that specifies the angle above which the tip of the miter will be truncated by a segment.

stroke.pattern

A string that specifies the pattern of a ragged line.

stroke.rotate

A string that specifies the rotation of a hatch line.

stroke.scaleType

A string that specifies the type of scale to be applied to the stroke.

stroke.shapeFill

A Fill object that represents the fill settings of the stroke.

stroke.space

A string that specifies the spacing of a hatched line.

stroke.strokeHinting

A Boolean value that specifies whether stroke hinting is set on the stroke.

stroke.style

A string that describes the stroke style.

stroke.thickness

An integer that specifies the stroke size.

stroke.variation

A string that specifies the variation of a stippled line.

stroke.waveHeight

A string that specifies the wave height of a ragged line.

stroke.waveLength

A string that specifies the wave length of a ragged line.


stroke.breakAtCorners

Availability

Flash MX 2004.

Usage

stroke.breakAtCorners

Description

Property; a Boolean value. This property is the same as the Sharp Corners setting in the custom Stroke Style dialog box.

Example

The following example sets the breakAtCorners property to TRue:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.breakAtCorners = true; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.capType

Availability

Flash 8.

Usage

stroke.capType

Description

Property; a string that specifies the type of cap for the stroke. Acceptable values are "none", "round", and "square".

Example

The following example sets the stroke cap type to "round":

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.capType = "round"; fl.getDocumentDOM().setCustomStroke(myStroke);

stroke.color

Availability

Flash MX 2004.

Usage

stroke.color

Description

Property; the color of the stroke, in one of the following formats:

  • A string in the format "#RRGGBB" or "#RRGGBBAA"

  • A hexadecimal number in the format 0xRRGGBB

  • An integer that represents the decimal equivalent of a hexadecimal number

Example

The following example sets the stroke color:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.color = "#000000"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.curve

Availability

Flash MX 2004.

Usage

stroke.curve

Description

Property; a string that specifies type of hatching for the stroke. This property can be set only if the stroke.style property is "hatched" (see stroke.style). Acceptable values are "straight", "slight curve", "medium curve", and "very curved".

Example

The following example sets the curve property, as well as others, for a stroke having the "hatched" style:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "hatched"; myStroke.curve = "straight"; myStroke.space = "close"; myStroke.jiggle = "wild"; myStroke.rotate = "free"; myStroke.length = "slight"; myStroke.hatchThickness = "thin"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.dash1

Availability

Flash MX 2004.

Usage

stroke.dash1

Description

Property; an integer that specifies the lengths of the solid parts of a dashed line. This property is available only if the stroke.style property is set to "dashed" (see stroke.style).

Example

The following example sets the dash1 and dash2 properties for a stroke style of dashed:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "dashed"; myStroke.dash1 = 1; myStroke.dash2 = 2; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.dash2

Availability

Flash MX 2004.

Usage

stroke.dash2

Description

Property; an integer that specifies the lengths of the blank parts of a dashed line. This property is available only if the stroke.style property is set to "dashed" (see stroke.style).

Example

See stroke.dash1.

stroke.density

Availability

Flash MX 2004.

Usage

stroke.density

Description

Property; a string that specifies the density of a stippled line. This property is available only if the stroke.style property is set to "stipple" (see stroke.style). Acceptable values are "very dense", "dense", "sparse", and "very sparse".

Example

The following example sets the density property to "sparse" for the stroke style of stipple:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "stipple"; myStroke.dotSpace= 3; myStroke.variation = "random sizes"; myStroke.density = "sparse"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.dotSize

Availability

Flash MX 2004.

Usage

stroke.dotSize

Description

Property; a string that specifies the dot size of a stippled line. This property is available only if the stroke.style property is set to "stipple" (see stroke.style). Acceptable values are "tiny", "small", "medium", and "large".

The following example sets the dotsize property to "tiny" for the stroke style of stipple:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "stipple"; myStroke.dotSpace= 3; myStroke.dotsize = "tiny"; myStroke.variation = "random sizes"; myStroke.density = "sparse"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.dotSpace

Availability

Flash MX 2004.

Usage

stroke.dotSpace

Description

Property; an integer that specifies the spacing between dots in a dotted line. This property is available only if the stroke.style property is set to "dotted". See stroke.style.

Example

The following example sets the dotSpace property to 3 for a stroke style of dotted:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "dotted"; myStroke.dotSpace= 3; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.hatchThickness

Availability

Flash MX 2004.

Usage

stroke.hatchThickness

Description

Property; a string that specifies the thickness of a hatch line. This property is available only if the stroke.style property is set to "hatched" (see stroke.style). Acceptable values are "hairline", "thin", "medium", and "thick".

Example

The following example sets the hatchThickness property to "thin" for a stroke style of hatched:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "hatched"; myStroke.curve = "straight"; myStroke.space = "close"; myStroke.jiggle = "wild"; myStroke.rotate = "free"; myStroke.length = "slight"; myStroke.hatchThickness = "thin"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.jiggle

Availability

Flash MX 2004.

Usage

stroke.jiggle

Description

Property; a string that specifies the jiggle property of a hatched line. This property is available only if the stroke.style property is set to "hatched" (see stroke.style). Acceptable values are "none", "bounce", "loose", and "wild".

Example

The following example sets the jiggle property to "wild" for a stroke style of hatched:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "hatched"; myStroke.curve = "straight"; myStroke.space = "close"; myStroke.jiggle = "wild"; myStroke.rotate = "free"; myStroke.length = "slight"; myStroke.hatchThickness = "thin"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.joinType

Availability

Flash 8.

Usage

stroke.joinType

Description

Property; a string that specifies the type of join for the stroke. Acceptable values are "miter", "round", and "bevel".

See also

stroke.capType

stroke.length

Availability

Flash MX 2004.

Usage

stroke.length

Description

Property; a string that specifies the length of a hatch line. This property is available only if the stroke.style property is set to "hatched" (see stroke.style). Acceptable values are "equal", "slight", "variation", "medium variation", and "random".

Example

The following example sets the length property to "slight" for a stroke style of hatched:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "hatched"; myStroke.curve = "straight"; myStroke.space = "close"; myStroke.jiggle = "wild"; myStroke.rotate = "free"; myStroke.length = "slight"; myStroke.hatchThickness = "thin"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.miterLimit

Availability

Flash 8.

Usage

stroke.miterLimit

Description

Property; a float value that specifies the angle above which the tip of the miter will be truncated by a segment. That means the miter is truncated only if the miter angle is greater than the value of miterLimit.

Example

The following example changes the miter limit of the stroke setting to 3. If the miter angle is greater than 3, the miter is truncated.

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.miterLimit = 3; var myStroke = fl.getDocumentDOM().setCustomStroke();

stroke.pattern

Availability

Flash MX 2004.

Usage

stroke.pattern

Description

Property; a string that specifies the pattern of a ragged line. This property is available only if the stroke.style property is set to "ragged" (see stroke.style). Acceptable values are "solid", "simple", "random", "dotted", "random dotted", "TRiple dotted", and "random triple dotted".

Example

The following example sets the pattern property to "random" for a stroke style of ragged:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "ragged"; myStroke.pattern = "random"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.rotate

Availability

Flash MX 2004.

Usage

stroke.rotate

Description

Property; a string that specifies the rotation of a hatch line. This property is available only if the stroke.style property is set to "hatched" (see stroke.style). Acceptable values are "none", "slight", "medium", and "free".

Example

The following example sets the rotate property to "free" for a style stroke of hatched:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "hatched"; myStroke.curve = "straight"; myStroke.space = "close"; myStroke.jiggle = "wild"; myStroke.rotate = "free"; myStroke.length = "slight"; myStroke.hatchThickness = "thin";

stroke.scaleType

Availability

Flash 8.

Usage

stroke.scaleType

Description

Property; a string that specifies the type of scale to be applied to the stroke. Acceptable values are "normal", "horizontal", "vertical", and "none".

Example

The following example sets the scale type of the stroke to "horizontal":

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.scaleType = "horizontal"; fl.getDocumentDOM().setCustomStroke(myStroke);

stroke.shapeFill

Availability

Flash 8.

Usage

stroke.shapeFill

Description

Property; a Fill object that represents the fill settings of the stroke.

Example

The following example specifies fill settings and then applies them to the stroke:

var fill = fl.getDocumentDOM().getCustomFill(); fill.linearGradient = true; fill.colorArray = [ 00ff00, ff0000, fffff ]; var stroke = fl.getDocumentDOM().getCustomStroke(); stroke.shapeFill = fill; fl.getDocumentDOM().setCustomStroke(stroke);

stroke.space

Availability

Flash MX 2004.

Usage

stroke.space

Description

Property; a string that specifies the spacing of a hatched line. This property is available only if the stroke.style property is set to "hatched" (see stroke.style). Acceptable values are "very close", "close", "distant", and "very distant".

Example

The following example sets the space property to "close" for a stroke style of hatched:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "hatched"; myStroke.curve = "straight"; myStroke.space = "close"; myStroke.jiggle = "wild"; myStroke.rotate = "free"; myStroke.length = "slight"; myStroke.hatchThickness = "thin"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.strokeHinting

Availability

Flash 8.

Usage

stroke.strokeHinting

Description

Property; a Boolean value that specifies whether stroke hinting is set on the stroke.

Example

The following example enables stroke hinting for the stroke:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.strokeHinting = true; fl.getDocumentDOM().setCustomStroke(myStroke);

stroke.style

Availability

Flash MX 2004.

Usage

stroke.style

Description

Property; a string that describes the stroke style. Acceptable values are "noStroke", "solid", "dashed", "dotted", "ragged", "stipple", and "hatched". Some of these values require additional properties of the stroke object to be set, as described in the following list:

  • If value is "solid" or "noStroke", there are no other properties.

  • If value is "dashed", there are two additional properties: "dash1" and "dash2".

  • If value is "dotted", there is one additional property: "dotSpace".

  • If value is "ragged", there are three additional properties: "pattern", "waveHeight", and "waveLength".

  • If value is "stipple", there are three additional properties: "dotSize", "variation", and "density".

  • If value is "hatched", there are six additional properties: "hatchThickness", "space", "jiggle", "rotate", "curve", and "length".

Example

The following example sets the stroke style to "ragged":

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "ragged"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.thickness

Availability

Flash MX 2004.

Usage

stroke.thickness

Description

Property; an integer that specifies the stroke size.

Example

The following example sets the thickness property of the stroke to a value of 2:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.thickness = 2; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.variation

Availability

Flash MX 2004.

Usage

stroke.variation

Description

Property; a string that specifies the variation of a stippled line. This property is available only if the stroke.style property is set to "stipple" (see stroke.style). Acceptable values are "one size", "small variation", "varied sizes", and "random sizes".

Example

The following example sets the variation property to "random sizes" for a stroke style of stipple:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "stipple"; myStroke.dotSpace= 3; myStroke.variation = "random sizes"; myStroke.density = "sparse"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.waveHeight

Availability

Flash MX 2004.

Usage

stroke.waveHeight

Description

Property; a string that specifies the wave height of a ragged line. This property is available only if the stroke.style property is set to "ragged" (see stroke.style). Acceptable values are "flat", "wavy", "very wavy", and "wild".

Example

The following example sets the waveHeight property to "flat" for a stroke style of ragged:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "ragged"; myStroke.pattern = "random"; myStroke.waveHeight = "flat"; myStroke.waveLength = "short"; fl.getDocumentDOM().setCustomStroke( myStroke );

stroke.waveLength

Availability

Flash MX 2004.

Usage

stroke.waveLength

Description

Property; a string that specifies the wave length of a ragged line. This property is available only if the stroke.style property is set to "ragged" (see stroke.style). Acceptable values are "very short", "short", "medium", and "long".

Example

The following example sets the waveLength property to "short" for a stroke style of ragged:

var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "ragged"; myStroke.pattern = "random"; myStroke.waveHeight = 'flat"; myStroke.waveLength = "short"; fl.getDocumentDOM().setCustomStroke( myStroke );

     < Day Day Up > 


    Developing Extensions for Macromedia Flash 8
    Developing Extensions for Macromedia Flash 8
    ISBN: 032139416X
    EAN: 2147483647
    Year: 2005
    Pages: 81

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net