Implicit coercion of a value of type __AS3__.vec:Vector to an unrelated type __AS3__.vec:Vector.<int
I have the following code:
I get this error:
| Scene 1, Layer 'Layer 1', Frame 1, Line 35 | 1067: Implicit coercion of a value of type __AS3__.vec:Vector to an unrelated type __AS3__.vec:Vector.<int>. |
import flash.display.Shape;
import flash.events.MouseEvent;
import flash.events.Event;
var g:Shape=new Shape();
var stageCenterX:Number=stage.stageWidth/2;
var stageCenterY:Number=stage.stageHeight/2;
var radius:Number=50;
var circumf:Number=Math.PI*2;
circumf=0;
var degrees:Number=360;
g.graphics.lineStyle(2,0xcc0000);
addChild(g);
g.graphics.moveTo(stageCenterX, stageCenterY+radius);
btn.addEventListener(MouseEvent.CLICK, onBtnClick);
function onBtnClick(e:MouseEvent):void{
addEventListener(Event.ENTER_FRAME, onEnterFrameEvent);
}
function onEnterFrameEvent(e:Event):void{
circumf+=.1;
var vectorcommands:Vector=new Vector.<int>;//(360, true);
for (var vcmd:int=0;vcmd<360; vcmd++){
vectorcommands.push(vcmd);
}
var vectorargs:Vector=new Vector.<Number>;//(720, true);
for (var vargs:int=0; vargs<720; vargs++){
vectorargs.push(Math.sin(vargs/degrees)*radius);
vectorargs.push(Math.cos(vargs/degrees)*radius);
}
for (var i:int=0; i<degrees*circumf; i++){
//g.graphics.lineTo(Math.sin(i/degrees)*radius+stageCenterX,Math.cos(i/degrees)*radius+stageCenterY);
g.graphics.drawPath(vectorcommands,vectorargs); //// LINE WITH ERROR
}
}
The question is, how do I properly push vectors? I am much more familiar with Arrays but the drawPath method uses Vectors.
