Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function drawPath()
- {
- var coords : Array<Float> = [ 100.0, 100.0, 200, 100, 200, 200, 150, 200, 150, 150, 180, 150, 180,
- 120, 120, 120, 120, 150, 150, 150, 150, 200, 100, 200, 100, 100 ];
- var holeIn : Int = 4;
- var holeOut : Int = 10;
- var s = new Shape();
- var g = s.graphics;
- var data = new Vector<Float>();
- var cmds = new Vector<Int>();
- var i :Int = 0;
- while ( i < coords.length ) {
- data.push(coords[i]);
- data.push(coords[i + 1]);
- if ((i == 0) ||(i == holeIn * 2) || (i == holeOut * 2)) {
- cmds.push(1); //moveto
- } else {
- cmds.push(2); //lineto
- }
- i += 2;
- }
- g.lineStyle(1, 0x0, 1, true, LineScaleMode.NORMAL, CapsStyle.SQUARE, JointStyle.MITER);
- g.beginFill( 0x00ccbb, 1.0 );
- g.drawPath(cmds, data,GraphicsPathWinding.NON_ZERO);
- g.endFill();
- addChild(s);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement