Load random flash movie

I was wandering if anyone knows a way to randomly load a flash movie into a specific place of the same dimensions.

I am creating a page where I have a spot for a flash movie, and I would like to randomly load 4-5 different animations into that space that would change randomly by refreshing the page.

Are there any tuts out there or does someone know how to do this?

Thanks in advance.

You have to make an array!
myarray = [“myswf1.swf”, “myswf2.swf”, “myswf3.swf”]
like this.
Now to load 'em use this action:
loadMovie(myarray[Math.floor(Math.random()*myarray.lentgh)], <path>);
This picks a random movie from the array and loads it. They have to be put on the first frame of your movie or ona movieclip between onClipEvent(load){} handlers!

Syko,

Thanks for the quick response.

I apologize buy my AS skills are incredibly weak. I tried to incorporate your code into my movie. I failed with flying colors.

If its not too much of an inconvienence, could you please take a loot at the attached zip and let me know what I am doing wrong?

thanks man.

here is another way of loading random swfs
just put that on the first frame and that it… ( and take out all the other actionscrip)

choice = Math.round(Math.random()*2);
switch (choice) {
case 0 :
loadMovie(“myswf1.swf”,0);
break;
case 1 :
loadMovie(“myswf2.swf”,0);
break;
case 2 :
loadMovie(“myswf3.swf”,0);
break;
}

Jakub K.

THanks man!

That was exactly what I am looking for.

Much appreciated.

ok… :slight_smile:

There is ton of other way you could do this… but the one i mentioned i think is great for beginners and easy to understand…

Jakub…