I want to create a set of random objects to fall down the stage in a loop.
So far I have created a test object to fall at a random x coordinate. I am having trouble working out how to loop the falling function so multiple instances of the object continuously fall.
var randomX:Number = Math.random() * 800;
test_mc.x = randomX;
test_mc.y = 0;
var speed:Number = 10;
test_mc.addEventListener(Event.ENTER_FRAME, moveDown);
function moveDown(e:Event):void
{
e.target.y += speed;
if(e.target.y >= 480)
{
test_mc.removeEventListener(Event.ENTER_FRAME, moveDown);
}
}
refer my a falling snow effect code.
The starting position of the snow is all random, almost same effect that real snow falling circumstance. If you run You’ll be amazed.
The Snow is My Custom MovieClip (white circle shape, width 15, height 15)
here is my demo: SnowEffect
here is my source: SnowEffect Down