However, we’re not done yet, right? How do we actually start loading the SWF file?  We need to tell the loader where it is and start the download process. This is the statement we need.

loader.load(new URLRequest("loadedMovie/loadedmovie.swf"));

So How It All Works

This is what happens step-by-step:

1st) the Preloader.swf starts. The “circular arrows” movieclip is already on the stage, so those arrows start spinning right away. “Percent” is also there, but it’s not displaying anything.

2nd) Flash runtime allocates and creates in memory all the variables and functions defined in our script, i.e., the “loader” object, the “loop” and “done” functions.

3rd) Flash runtime then starts executing our ActionScript 3.0 statements one at a time.  The first two statements are the addEventListener statements. This “wires up,” so to speak, the two event handlers, “loop” and “done,” to our “loader” object.  The next statement is the one that starts the load operations, i.e., “loader.load(new URLRequest("loadedMovie/loadedmovie.swf")).”

4th) Now programme execution is totally under the control the ActionScript 3.0 event manager, i.e., it keeps firing off the  ProgressEvent.PROGRESS event. That causes the “loader” object to call the “loop” function, and the “loop” function is given all the information it needs to tell us how many bytes of loadedmovie.swf have downloaded when the call was made. Finally, when it is completely downloaded, the event manager fires off the Event.COMPLETE event, and that causes the “loader” object to call the “done” function, which displays loadedmovie.swf.

That’s it – it’s that easy.