View Full Version : loading random movie clip in a loop

09-22-2009, 05:48 PM

I'm looking to load a random movie clip, but to play one after the other, so once one finishes I want to load another one.

I have this so far:

var myMovieSequence = 2;

// Creates the random number:
var myRandomNumber = Math.floor(Math.random()*myMovieSequence)+1;

// Creates the full Flash Movie name like: 1.swf
var myMovieName = myRandomNumber + ".swf";

// Loads the random Flash Movie:
loadMovieNum(myMovieName, 0);

So this does select a movie clip at random, and displays it, but once that movie clip has finished playing nothing happens...and I'd like to display another random movie clip.

This code is in frame 1 of the timeline, so I've tried adding things like gotoAndPlay(1); to reload the frame but with no luck.

I'm guessing I need to somehow add a loop, but I don't know how to make it reload frame 1 - I'm completely new to flash!!

Really appreciate your help.

Nicky xx