How to set linestyle to solid/dashed/dotted/ragged/stippled in flash?
I am using Flash CS4, and it has a feature of drawing开发者_开发问答 solid/dashed/dotted/ragged/stippled lines. But, I can't find API for drawing a line of these styles. Graphics.lineStyle() doesn't support it. How can I draw styled lines progammatically?
EDIT: Included ragged/stipple style
Manual solution, found here. Works well under AS2, but might require some tweakign to make it work under AS3.
var dotWidth:Number = 4;
var spaceBetweenDots:Number = 1;
var totalLineWidth:Number = 250;
var dotsPerLine:Number = totalLineWidth / (dotWidth + spaceBetweenDots);
for (var i:Number = 0; i < dotsPerLine; i++)
{
var dottedLine:MovieClip = _root.createEmptyMovieClip("topLine_" + i, this.getNextHighestDepth());
dottedLine.lineStyle(0, 0x000000, 100);
dottedLine.lineTo(dotWidth, 0);
dottedLine._x = i * (dotWidth + spaceBetweenDots);
dottedLine._y = 50;
}
You could add a bit random in there to get ragged lines:
var dotWidth:Number = 4;
var spaceBetweenDots:Number = 0;
var totalLineWidth:Number = 250;
var dotsPerLine:Number = totalLineWidth / (dotWidth + spaceBetweenDots);
var ragVariance: Number = 2;
for (var i:Number = 0; i < dotsPerLine; i++)
{
var raggedLine:MovieClip = _root.createEmptyMovieClip("topLine_" + i, this.getNextHighestDepth());
raggedLine.lineStyle(0, 0x000000, 100);
raggedLine.lineTo(dotWidth-random(ragVariance), random(ragVariance));
raggedLine._x = i * (dotWidth + random(spaceBetweenDots));
raggedLine._y = 100+random(ragVariance);
}
精彩评论