Please, Help me... Random play for movieclip

Hi, I need help for this,

how can play a MovieClip in a random delay or at random time in my main scene? need an actionscript? anybody can help me?

in advance, thankful

koamis :tb:

Put this code in frame1 of your mc
random_number = random(1500)+1000;
delay = setInterval(this, “play”, random_number);
//and in the last frame
Alter the number in the brackets to change the “randomness”

Hope that helps


Thanks SteveD, especially for your promptitude

I put the code in frame 1 and set (10500)+1000 but it continue at constant play, my MC have 450 frames, can affect this?

again, thanks

Apologies, change the number outside the bracket, that will give you more of a delay.
The code will only delay in frame 1, once the playhead leaves fr1 it will play normally.
You can do on of two things (if you want to change this)
alter :
[AS]delay = setInterval(this, “play”, random_number);
delay = setInterval(this, “nextFrame”, random_number);[/AS]

this will advance the plyahead one frame at a time and invoke delay() in every frame, alternatively if you want the the animation to stop at certain points, leave the code as is and put:
at different key frames along the 450 frames

Hope that helps


Hey, this script work for me…


random_number = Math.ceil(Math.random()*5000);
delay = setInterval(this, “play”, random_number);

thanks for the enlightenment