I am generating movieClips outside of the stage I want to send them randomly into the stage in enter frame.
Currently it looks like this, so they go like in all directions…
How could I direct each of them randomly **into **the stage?
function timerEvent(e:TimerEvent):void {
var newObj:MyObj=new MyObj();
//this places them randomly outside of the stage
var side:String = RandomOffStage.position(newObj, null, stage, constantString);
newObj.speedX=Math.random()*20-10;
newObj.speedY=Math.random()*20-10;
myArray.push(newObj);
}
addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, true);
function enterFrameHandler(e:Event):void {
for (var i:uint = 0; i < myArray.length; i++) {
var myObj:MyObj = (MyObj)(myArray*);
myObj.x+=myObj.speedX;
myObj.y+=myObj.speedY;
}
}