PDA

View Full Version : go to a random frame


rabblerouser
05-16-2004, 09:19 PM
Hi...
I'm trying to get a movie clip to go to a random frame upon loading onto the main timeline. I have a clip event attached to the MC that goes as follows:

onClipEvent (load) {
ranFrame = ["one", "two", "three", "four", "five"];
this(ranFrame[Math.floor(Math.random()*ranFrame.length)]);
}

It's not working but I think I'm close to figuring it out. Any ideas?

Jahepi
05-16-2004, 09:45 PM
onClipEvent (load) {
ranFrame = ["one", "two", "three", "four", "five"];
s = ranFrame[random(ranFrame.length)];
this.gotoAndPlay(s);
}

I hope it helps

bye

oldnewbie
05-16-2004, 09:57 PM
Or...

onClipEvent (load) {
ranFrame = ["one", "two", "three", "four", "five"];
this.gotoAndStop(ranFrame[Math.round(Math.random()*4)]);
}

rabblerouser
05-17-2004, 08:05 AM
Wow, that works great! Thank you so much!