[F5] random movie shuffling

Hi, I’ve been designing this interface for my site. It contains a mini-tv thing in the corner that plays external flash movies selected at random from a list and loaded into an empty MC (“external_screen”) with “loadMovie”.

the code is as follows

onClipEvent (load) {
movieList = [“technical_fault”, “skag”];
_root.external_screen.loadMovie(movieList[Math.floor(Math.random()*movieList.length)]+".swf");

}

where “technical_fault” and “skag” are external swf files

How do I make it so that when a movie finishes, the previous code is run again and a new movie is selected?

cheers

I would make it a function like so


movieList = ["technical_fault", "skag"]; 
tvScreenLoader = function(){
  _root.external_screen.loadMovie(movieList[Math.floor(Math.random()*movieList.length)]+".swf"); 
}

that would go into one of the first frames of your main movie.

Then, each external swf that is being loaded, should have on it’s last frame
_root.tvScreenLoader();

the function will be called each time a movie finishes, loading a new one into the tv.

nice one mate, the code’s been through four changes, i think this is the best one so far!

thanks again

slight problem here, the code loads the first movie, which plays, but then for some reason when the external movie gets to the last frame it doesn’t seem to activate the _root.tvScreenLoader to load the next movie…?

nope, my mistake, fixed it.

thanks a lot! :slight_smile: