Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random movie generator 1

Status
Not open for further replies.

Jofunu6

Technical User
Apr 29, 2003
7
AU
I have a problem. I have searched and searched through many sites (including this one) but cannot find an answer to my seemingly simple question. I have 3 .swf movies (that could be used from a .fla file if needs be) and I want the Flash to randomly play 1 of them each time the movie is started. The main problem is I can't use JavaScript for security reasons, and I haven't learnt much actionscript yet.

Please help!
 
If your movie were named movie1.swf, movie2.swf, movie3.swf, it could be as simple as...

stop();
i = random(3)+1;
loadMovieNum("movie"+i+".swf", 5);

But you should also look into the more accurate new Math.random()

Regards,

cubalibre2.gif
 
thanks, I tried the Math.random() but your method worked better.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top