drawPath()画线路径颜色填充


/*
var commands:Vector.<int >  = new Vector.<int > (5,true);
commands[0] = GraphicsPathCommand.MOVE_TO;
commands[1] = GraphicsPathCommand.LINE_TO;
commands[2] = GraphicsPathCommand.LINE_TO;
commands[3] = GraphicsPathCommand.LINE_TO;
commands[4] = GraphicsPathCommand.LINE_TO;
var data:Vector.<Number>  = new Vector.<Number> (10,true);
data[0] = 10;
data[1] = 10;
data[2] = 100;
data[3] = 10;
data[4] = 100;
data[5] = 100;
data[6] = 10;
data[7] = 100;
data[8] = 10;
data[9] = 10;
graphics.beginFill(0x800000);
graphics.drawPath(commands, data);
*/

/*
var commands:Vector.<int>  = new Vector.<int> (8,true);
commands[0] = GraphicsPathCommand.MOVE_TO;
commands[1] = GraphicsPathCommand.LINE_TO;
commands[2] = GraphicsPathCommand.LINE_TO;
commands[3] = GraphicsPathCommand.LINE_TO;
commands[4] = GraphicsPathCommand.LINE_TO;
commands[5] = GraphicsPathCommand.LINE_TO;
commands[6] = GraphicsPathCommand.LINE_TO;
commands[7] = GraphicsPathCommand.LINE_TO;
var data:Vector.<Number>  = new Vector.<Number> (14,true);
data[0] = 10;
data[1] = 10;
data[2] = 100;
data[3] = 10;
data[4] = 100;
data[5] = 100;
data[6] = 50;
data[7] = 100;
data[8] = 50;
data[9] = 50;
data[10] = 10;
data[11] = 50;
data[12] = 10;
data[13] = 10;
graphics.beginFill(0x800000);
graphics.drawPath(commands, data);
*/

//graphics.beginFill(0x800000);
//graphics.drawPath( Vector.<int>([1,2,2,2,2]), Vector.<Number>([10,10, 100,10, 100,100, 10,100, 10,10]));

//var commands:Vector.<int>  = new Vector.<int> ([1,2,2,2,2,2,2,2]);
//var data:Vector.<Number>  = new Vector.<Number> ([10,10,100,10,100,100,50,100,50,50,10,50,10,10]);

//其中的值 1 表示 MoveTo() 命令,值 2 表示 LineTo() 命令
//var arr:Array=[1,0,2,2,2,2,2,2];
var arr:Array=[1,2,2,2,2,2,2,2];
var arr1:Array=[10,10,100,10,100,100,50,100,50,50,10,50,10,10];
var commands:Vector.<int> = Vector.<int>(arr);
var data:Vector.<Number> = Vector.<Number>(arr1);
graphics.lineStyle(0x000000,1);
graphics.beginFill(0xff0000,0.5);
graphics.drawPath(commands,data);
trace(GraphicsPathCommand.MOVE_TO);
trace(GraphicsPathCommand.LINE_TO);
trace(GraphicsPathCommand.CURVE_TO);

posted on 2011-03-22 13:25  602147629  阅读(4616)  评论(0编辑  收藏  举报