PDA

View Full Version : play random movie clip



shuga
September 20th, 2002, 02:54 PM
i have a series of movie clip instances (of the same movie) on the stage all numbered 0 through 15

its a simple experiment but i can't get it to work

heres what i want to do

i want


onClipEvent(enterFrame){
i=random(15);
"i".gotoAndPlay(2);
}

to work

i have the actionscript on a clip called controller that is on the main stage.

i want it to choose a random number between 0 and 15 and then play that number's corresponding instance of the movieclip

this is possible i think ... i'm sure i'm just missing something simple

thanks in advance for the help.

flex
September 20th, 2002, 03:06 PM
onClipEvent (enterFrame) {
i = random(15);
_root[i].gotoAndPlay(2);
}

When referring to variables that are integers (numbers) lose the quotes.

flex
September 20th, 2002, 03:07 PM
and use _root because the movie clips are not sub clips of your controller clip.

shuga
September 20th, 2002, 03:47 PM
it works .. thank you