Preloader

Hi.

I have a movie in a single frame that have the following action script to random load external swf’s.

I wonder how can i do to preload the swf’s first


function virgem(){
movies = [1,2,3,4,5];
last = Math.floor(Math.random()*movies.length);
loadMovie("random_index_port/random" + movies[last] + ".swf","background");
}

function rnd(){
movies = [1,2,3,4,5];
choice = Math.floor(Math.random()*movies.length);
 while(choice == last) {
 choice = Math.floor(Math.random()*movies.length);
 }
last = choice;
loadMovie("random_index_port/random" + movies[last] + ".swf","background");
}

a=1;
if (a==1) { virgem(); a=2; }

timer = setInterval(rnd,10000);
stop();

I’ve seen this code somewhere… a preloader…


frame 1:
loadMovie("myMovie.swf","myTarget");

frame 2:
// nothing in here

frame 3:
actBytes = myTarget.getBytesLoaded() || 0;
totBytes = myTarget.getBytesTotal() || 100;
percent  = Math.round(actBytes * 100 / totBytes);

if( totBytes - actBytes > 10){
	// if you don't want a bar, delete the following line
	bar._xscale = percent;
	gotoAndPlay(2)
}

frame 4:
// ready, go

But i’m not using gotoandplay in my movie and he starts playing the swf right away, so won’t the second preloader example do the same… help :slight_smile: