
//called from constructor
polygon(thisArray);
public function polygon(arr:Array):void{
trace (arr) ; //ok
var sh:Sprite= new Sprite();
sh.graphics.lineStyle(1,0xCCCCCC);
sh.graphics.moveTo(arr[0],arr[1]);
sh.graphics.beginFill(0xFF9900, 1);
for (var i=0; i<arr.lenght; i+=2){//
if (i==0){
sh.graphics.moveTo(arr[i], arr[i+1]);
}else{
sh.graphics.lineTo(arr[i],arr[i+1]);
if (i==6 || i==2){
sh.graphics.lineStyle(1,0xCCCCCC,0);
}else{
sh.graphics.lineStyle(1,0xCCCCCC);
}
}
}
sh.graphics.endFill();
addChild(sh);
}
If you would like to make a comment, please fill out the form below.
Recent Comments