Random Boss

How do you load a random jpeg or swf file into a main swf file?


If your pics or swf are named 1.jpg 2.jpg or 1.swf 2.swf and so on you could put this code in your first frame:[AS]empty.loadMovie(random(5)+".jpg");[/AS]
Of course you have to create an empty MC, place it on your scene and call it empty (or whatever you like…)
5 is the number of pictures that you should load. All files has to be in the same folder, otherwise you have to specify where the pics are.

The random() function is deprecated, but I still use it… Easier to write than Math.random… But if you use Math.random the code would be:

good man.