moving objects in an array
First off I have 6 boxes of random width and height falling at random x positions.I can't get them to each fall at random speeds. I dono what I did but now they fall at an overal same speed but they speed up and slow down over a fraction of a second. here's what I have
var rArray:Array = new Array();
for (var i = 0; i<6; i++)
{
var rect = new box();
addChild(rect);
rect.x = Math.random() * (stage.stageWidth - 150);
rect.y=-200;
rect.width = Math.floor(Math.random() * (400-150) + 150);
rect.height = Math.floor(Math.random() * (400-150) + 150);
rArray.push(rect);
}
stage.addEventListener(Event.ENTER_FRAME,fallDown,false,0,true);
function fallDown(e:Event):void {
for (var i = 0; i<rArray.length/2; i++) {
rArray.y += 20;
}
for (var n = rArray.length/2; n<rArray.length; n++) {
rArray
}
}
if (rArray.y>stage.stageHeight) {
rArray.y=-200;
}
second how would I go about deleting them so once they fall off the stage they respawn with different dimensions?