How can I draw a circle with dashed line/stroke?
How can I draw a circle with dashed line/stroke?
Using a for cycle and using the equation of the circle wouldn't it be too slow?
♥0 |
Line 23 |
Modified 2009-09-21 17:13:58 |
MIT License
archived:2017-03-09 14:21:25
ActionScript3 source code
/**
* Copyright maesy ( http://wonderfl.net/user/maesy )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/s2pG
*/
//How can I draw a circle with dashed line/stroke?
//Using a for cycle and using the equation of the circle wouldn't it be too slow?
package {
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.LineScaleMode;
import flash.display.CapsStyle;
import flash.display.JointStyle;
public class DashedCircle extends Sprite {
private var shape:Shape;
public function DashedCircle() {
circle();
}
private function circle():void{
shape = new Shape();
shape.graphics.beginFill(0xFF0000, 1);
//Can i set a dashed line style?
shape.graphics.lineStyle(2, 0x000000, 1, true, LineScaleMode.NONE, CapsStyle.SQUARE, JointStyle.MITER, 3);
shape.graphics.drawCircle(x, y, int(stage.stageWidth / 2));
shape.graphics.endFill();
this.addChild(shape);
shape.x = stage.stageWidth/2;
shape.y = stage.stageHeight/2;
}
}
}