The Test
To make sure that this technological masterpiece is working, let's pop it into a new document and use it to load something.
Open the Components panel. Nopethe component doesn't show up there yet, so don't bother looking for it.
Open the options menu in the Component panel and choose Reload. Now The_Loader should appear in a folder called Custom (or whatever you named it).
Create a new Flash document and drag an instance of The_Loader to the Stage.
In the Load this field in the Property inspector, enter the path to an image or .swf file, as shown in Figure 3.
The Load it here field says to load the asset into _parent.clip_mc (remember, the loadItHere variable is inside the component, so _parent refers to the main timeline in this case), so add a movie clip to the stage and assign it the instance name clip_mc.
Run a test movie.
Figure 3 The dern thing works...I hope.
NOTE
Note: The onLoadProgress() method does not fire when loading assets from your own computer. The asset must be loaded over http. To test the component, simply enter the path to an image on the Web. If you don't have your own site, use the URL to an image from a Google image search. (It helps if the image you're loading has a large file size.)
Voila!
If you've followed along, the text field in the component runs a percentage count, starting at 0% and incrementing to 100%. When the image is fully loaded, the number disappears and the image is displayed.
Building this component may have been a little time-consuming, but now that you've done it, you can toss it into any project. All you have to do is enter the path to the asset and the name of the clip in which to load the asset.
This component works only with Flash Player 7, so if you want to pre-load assets in older players, you'll have to find yourself another tutorial. (Sorry.)
Until next time, happy Flashing.