PDA

View Full Version : Trying to get a continuous falling animation ...


Buria
03-28-2003, 10:01 PM
I'm currently designing a website calling for a multitude of feathers to fall on the right hand side continuously. I know I can do this with a DuplicateMovieClip on a button .... but I don't want it on the button. Is there anyway to get the feathers to fall automatically when the frame loads? Or am I going to have to keep the button?

Thanks for the help,
Buria

tyard
03-28-2003, 10:56 PM
No need for a button at all. Just place your code on the frame itself. You can create a recurring function (by using an onEnterFrame) to keep the feathers falling.

Buria
03-29-2003, 04:14 PM
Ah! Thank you! I can't believe it was something that simple. You have made my day so much better by helping me. I've been trying to figure that out for days now!

~Buria

Buria
03-29-2003, 05:02 PM
This is the code I am using:

(onEnterFrame); {
count = 1;
while (count<10) {
_root.box.duplicateMovieClip("boxx"+count, count);
_root["boxx"+count]._x = random(550);
_root["boxx"+count]._y = random(550);
_root["boxx"+count]._xscale = random(100);
_root["boxx"+count]._yscale = random(100);
_root["boxx"+count]._alpha =(80);
count += 1;
}
}


If it looks familiar it's from the DuplicateMovieClip tutorial. Ok, here's my question .... How can I get the feathers to fall just on the right side? I'm having a problem with them only playing on the left and can't get them to move over. Now, the solution is probably right in front of my face .... I haven't learned Actionscript yet, so my apologies if this is extremely simple.

Thanks!
~Buria

tyard
03-29-2003, 05:30 PM
_root["boxx"+count]._x = random(550);

This places the clip at a horizontal position on the stage. random(550) finds a random number between 0 and 550. If you want to limit the range to, say, 400 - 550, which is the right 150 pixels on the stage, you'd use:

_root["boxx"+count]._x = random(150) + 400;