< 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 objectThe following properties are available for the Stroke object:
stroke.breakAtCornersAvailability 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.capTypeAvailability 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.colorAvailability Flash MX 2004. Usage stroke.color Description Property; the color of the stroke, in one of the following formats:
Example The following example sets the stroke color: var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.color = "#000000"; fl.getDocumentDOM().setCustomStroke( myStroke ); stroke.curveAvailability 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.dash1Availability 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.dash2Availability 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.densityAvailability 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.dotSizeAvailability 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.dotSpaceAvailability 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.hatchThicknessAvailability 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.jiggleAvailability 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.joinTypeAvailability 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.lengthAvailability 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.miterLimitAvailability 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.patternAvailability 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.rotateAvailability 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.scaleTypeAvailability 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.shapeFillAvailability 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.spaceAvailability 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.strokeHintingAvailability 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.styleAvailability 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:
Example The following example sets the stroke style to "ragged": var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "ragged"; fl.getDocumentDOM().setCustomStroke( myStroke ); stroke.thicknessAvailability 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.variationAvailability 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.waveHeightAvailability 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.waveLengthAvailability 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 > |