You do know that movie loading is sequential (basically one after the other), and that by preloading several movies in the main movie's preloader, no preloading time will have been saved, which I guess was the point in having external movies in the first place. Otherwise just convert your movies into movie clips, they'll load up with the main movie.
That said you can easily preload any number of external movies within your main movie's preloader.
First off your external movies should have a stop(); action on their first frames, to keep them from playing when fully loaded and until you make them play. If they have their own preloaders, than the pseudo code would be along these lines...
In the main movie's preloader first few frames, you would call the load of the first of these movies...
The preloader in the external movie then kicks in, and when the movie is fully loaded, rather than have the movie play, it just stops it on it's first frame and on this first frame, signals the main movie's preloader that the first movie is loaded and ready with...
_level0.nextFrame();
The main movie's preloader is thus moved to the next frame where a second external movie would be preloaded...
...And so fourth for each movie you have to preload.
When all the movies are preloaded, the move to the next frame would now call the preloading of the main movie itself, and when that's done, the main movie should start playing. Since your external movies have been preloaded, they can be told to play at any given point in time, in the usual manner.
This could also all be done within the main movie's preloader (with no preloaders in the external movies themselves!), but would require a litte more complex preloading script.
Thanks for the tips. I will use them on my next project. However, I am too deep into this one to turn back. My question should have been is it possible to preload the next movie while you are currently playing another one. For example, say I have 2 400kb swfs and the first one is currently playing, is there a way to preload and cache the next movie so when the current one exits (per a button or other command) it will have this next movie already cached? Or can both be preloaded initially??
Both can be preloaded initially with something like I posted above.
Otherwise you can initiate the preloading of the second movie as soon as the first one is playing. On the first frame (out of the preloader) of the first movie, just load up your second movie. But it should have a stop(); action on it's first frame, or it will start streaming.
Now wether this second movie will have time to completely preload while the first one plays is playing is another story. Depends on the length of the first movie, the complexity and weight of the second movie, and somewhat to the user's connection speed. You have to test run it with different connection speeds.
At the end of the first movie, you simply tell the second one to play, and hope!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.