1. main.swf loads. It contains all the navigation buttons in various 'skins':
appropriate sets of buttons depending on the content loaded.
2. This movie loads all the way before it will play (loading vital interface
elements); embedded in the loadbar movie clip is this code:
if (_parent._framesloaded >= _parent._totalframes){
//movie is loaded, restart movie
_level0.play();
} else {
//scale the loading bar
loadbar._xscale = (_parent._framesloaded/_parent._totalframes)*100;
gotoAndPlay(1);}
2. When the user calls an external swf the name is stored as nextMovie and the
main movie is sent to it's loading frame.
3. The requested movie is loaded into a blank clip called content, positioned
at x=0, y=0
loadMovie (_level0.nextMovie, content);
4. The main timeline stops. When the content clip loads, it sets a number of
variables, including how many frames should be preloaded, and stops.
5. A diverting graphic (the pouring pint) plays on the main timeline while the
content Movie Clip loads
6. A movie clip (in the library as preloader) inside the loaded content (in
this case bin.swf) on the' preloader' layer loops.
if (_parent._framesloaded > _parent.loadToHere){
//movie is loaded, restart content and control
_level0.play();
_parent.play();
} else {
//scale the loading bar
loadbar._xscale = (_parent._framesloaded/_parent.loadToHere)*100;
gotoAndPlay(1);
}
7. When sufficient frames have loaded to ensure smooth playback the timelines
are restarted.
8. Depending on the buttons needed, the main timeline goes to the right 'skin'
This script is an industrial strength preloading engine which correctly loads
the right movies on any speed connection.
The key is the structure: movie clips determine themselves whether they are
loaded and this produces far fewer problems.