Preloading multiple movies!

Hey there! =)

I’m looking for a tutorial for preloading multiple swfs or if some of you got some NICE AS you would like to share!?

Here’s the thing:
I got a main movie and two external movies, and I would like to load them all at once, with a simple percentage preloader!

SO, is it possible to put this hardcore preloader in the first scene of my main movie, so it preloads the main movie and my two external movies?

When the loading is done, it jumps to the next scene of my main movie, and then I just use the LoadMovie() function to show the external swfs when needed…!?

You cannot preload a movie that hasn’t even been loaded into flash yet. If you want just one big preloader then why not just put your whole site into one movie, the main use for multiple movies is to have small downloads by loading preloaded movies separatly. If you want to preload the movies separatly then I can show you how to do that if ya like!

oh yes you can! :cowboy:

the reason I use external movies, is to get a better general view! normally I preload the movies separtly, but in this case it would be nice to load them all at once!

There a serveral ways to make multiple preloaders, but I havent found one yet that I could figure out!

heres some: bokelberg.de

Well the reason I said you can’t load all the movies at the same time is because you said:

When the loading is done, it jumps to the next scene of my main movie, and then I just use the LoadMovie() function to show the external swfs when needed…!?

Which in hence, means that you have not even brought the external movies into flash until they are needed by using loadMovie(). You cannot preload anything that hasn’t been executed yet. You can however load all the movies at the beginning and hide them. That would mean that you wouldn’t use loadMovie() throughout your movie, but instead just make them visible when needed. Do you get what I am trying to say?

YEAH!..

Do you know how to do this!?
I’m messing around with this code, but I can’t quite get the percent to count:

loadMovie("01.swf","_root.mc1");
loadMovie("02.swf","_root.mc2");
preloadTargets = [_root,_root.mc1,_root.mc2];
this.onEnterFrame = function() {
percentageLoaded = 0;
var curLoad = 0;
for(var dat in preloadTargets) {
if (preloadTargets[dat].getBytesTotal() > 32) {
curLoad++;
percentageLoaded += Math.round(preloadTargets[dat].getBytesLoaded() / preloadTargets[dat].getBytesTotal()*100);
}
}
percentageLoaded /= curLoad;
if (percentageLoaded == 100 && curLoad == preloadTargets.length) {
delete this.onEnterFrame;

}
}

First off make sure you have a dynamic text fiels with a ‘var’ value of percentageLoaded and then place your movies on a remote location so that you can test out the preloader. Flash won’t show your preloader because when testing locally the file doesn’t need to be loaded because it is already cached on your computer!

yeah… I know, but you can test the preloader by hitting “Ctrl+ENTER” twise… But it still won’t show me the loading process! ■■■■! :*(

ALLRIGHT!

I got it working now, BUT I get some decimal points in the percentage text box, why is that?? :*(

Try adding Math.round, so it would look like: Math.Round(Variable);

Hi,
Hope someone is still following this thread, I have been playing around with the code above for a multiple movie preloader, it works fine, both on my hard drive and on line.
However, once the movies have loaded I want the playhead to move on automatically. I have tried inserting a
gototAndPlay action like this:

[AS]if (percentageLoaded == 100 && curLoad == preloadTargets.length) {
gotoAndPlay(5);
delete this.onEnterFrame;
}
}[/AS]

but… this works fine on my hard drive, but is completely ignored on line - any ideas as to why, also, can any one tell me what the[ B]>32 ** releates to in this line:
[AS]if (preloadTargets[dat].getBytesTotal() > 32) {[/AS]

Cheers
SteveD