Graphics.drawPath( 2010-5-21) Kazutaka forked:0favorite:0lines:32license : MIT License modified : 2010-05-22 16:42:12 Embed Tweet package { import flash.display.GraphicsPathCommand; import flash.display.GraphicsPathWinding; import flash.display.Shape; import flash.display.Sprite; public class FlashTest extends Sprite { public function FlashTest() { // write as3 code here.. var myShape:Shape = setDrawPathSqare( 20, 20, 200, 150,0xcccccc); this.addChild( myShape ); } public function setDrawPathSqare(nx:Number,ny:Number,nw:Number,nh:Number, nCol:uint):Shape{ var commands:Vector.<int>=new Vector.<int>(); commands.push( GraphicsPathCommand.MOVE_TO); commands.push( GraphicsPathCommand.LINE_TO); commands.push( GraphicsPathCommand.LINE_TO); commands.push( GraphicsPathCommand.LINE_TO); var data:Vector.<Number>=new Vector.<Number>(); data.push(nx,ny); data.push(nx+nw,ny); data.push(nx+nw,ny+nh); data.push(nx,ny+nh); data.push(nx, ny); var winding:String=GraphicsPathWinding.EVEN_ODD; var shape:Shape = new Shape(); shape.graphics.beginFill( nCol ); shape.graphics.drawPath( commands, data, winding ); shape.graphics.endFill(); return shape; } } } Code Fullscreen Preview Fullscreen drawPath,Player10 push Vector addChild String uint Sprite int Number