AS3 Dotted Line Class
Here is an ActionScript 3 class I use all the time to draw pixel perfect dotted lines in Flash. Free for any use other than reselling.

Here is an ActionScript 3 class I use all the time to draw pixel perfect dotted lines in Flash. Free for any use other than reselling.

First!
And thanks!
Awesome. By the way, what a great way to separate your functions in your code!
very great ;)
Very good job ! Very orderly in your work. :)
Simple and useful!
Excelent! Thanks man!
Definitely a time-saver, thank You for sharing!
Allow me two notes though, what i saw after 2 minutes of testing…
1. in the constructor the “dotAlpha” doesn’t have a type declaration, i used Number, like “dotAlpha:Number = 1″.
2. the variable “tile” of type BitmapData has a height of “_h +1″, that gave me a one pixel artifact ( occasionally ), changing it to just “_h” gives the desired result…i’m wondering why the +1 though.
Still, nothing that one wouldn’t notice after using Your class – easy to pin.
Great share, thanks again Jay!
Good!一个字,“好”
just looking at the AS really quick and I’m still getting use to using classes and I figured out all the values except for the “0.9″. What does that control?
var s:Shape = new DottedLine(630, 1, 0×603120, 0.9, 1, 2);
Ok I figured that out. But now another question. In the AS file, _h is more of a stroke weight that an actual height. How would the AS be altered to have the properties control a line that runs vertically instead of horizontal?
“How would the AS be altered to have the properties control a line that runs vertically instead of horizontal?”
I would like to know this too.
Ohh, simple use s.rotation = 90; to align it vertical :-)
import com.warmforestflash.drawing.DottedLine;
import flash.display.*;
import flash.events.*;
stage.align=StageAlign.TOP_LEFT;
stage.scaleMode=StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, resizeHandler);
function resizeHandler(e:Event=null):void{
var s:Shape=new DottedLine(stage.stageWidth – 44, 1, 0×603120, 1, 1, 2);
addChild(s);
s.x = 22;
s.y = 22;
}
resizeHandler()
On the right side of the site is not align. How to change the parameters to align dot 22px on the left site and 22px on the right side?