Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can you preload multiple flash movies at same time?

Status
Not open for further replies.

Flashoid

Technical User
Dec 11, 2002
163
US
I am trying to preload several flash movies at the beginning preload - is this possible? If so please advise.

thanks
 
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...

stop();
_level0.holder1_mc.loadMovie("first.swf");

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...

stop();
_level0.holder2_mc.loadMovie("second.swf");

...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.

Hope this helps!





Regards,

cubalibre2.gif
 
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??


thanks

 
yes easy to do

one method is to load the second file while the first is playing into an empty clip with instance name myclip, say
and on main timeline

myclip._visible = false;

then on exit or whatever set visible to true.
 
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!

Regards,

cubalibre2.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top