PDA

View Full Version : [F5] random movie shuffling



darklogik_org
April 18th, 2003, 03:56 AM
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

upuaut
April 18th, 2003, 04:08 AM
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.

darklogik_org
April 18th, 2003, 04:11 AM
nice one mate, the code's been through four changes, i think this is the best one so far!

thanks again

darklogik_org
April 18th, 2003, 04:17 AM
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...?

darklogik_org
April 18th, 2003, 04:40 AM
nope, my mistake, fixed it.

thanks a lot! :)