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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading random movie clips

Status
Not open for further replies.

Hskrdoo

Programmer
Aug 27, 2001
13
0
0
US
I have about 20 .swfs that reside in the same folder. How do I get all 20 swfs to randomly load into an html page? They are training quotes that fade in and fade out and i just need them to cycle randomly. Any suggestion would be greatly appreciated.
 
dont know if i read you correctly or not but assuming that you are only displaying one swf at a time

theSwfs = ["one.swf","two.swf",.......,"twenty.swf"];

function loadAMovie (){
loaderClip.loadMovie(theSwfs[Random(theSwfs.length)]);
}
 
I put the code in the first frame of a blank loader movie and I renamed all of my swfs to match the code, but it's still not working. None of the movies will load. Am I missing something?
 
you put the code on the main timeline and then call the function whenever you want another movie to load.....ie when the last has faded out
 
Since there's a probability that random would generate the same number twice (or even more...), I'd generate a unique random number viewing array, at the start and everytime a set of 20 have in fact played.
I'd then used an onEnterFrame function to load the movies according to the unique number array, as well as monitoring their current playing frame (compared to their total frames - they could thus be of different lengths...), to start off the next movie, when the previous movie has reached it's end...
Once the first cycle of 20 quotes has played, a new random array is generated, and the movies again loaded and playing automatically...

Regards. Affiliate Program - Web Hosting - Web Design
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top