ActionScript 2.0 Components Language Reference |
|
|
|
| Loader component > Using the Loader component | |||
You can use a loader whenever you need to retrieve content from a remote location and pull it into a Flash application. For example, you could use a loader to add a company logo (JPEG file) to a form. You could also use a loader to leverage Flash work that has already been completed. For example, if you had already built a Flash application and wanted to expand it, you could use the loader to pull the old application into a new application, perhaps as a section of a tab interface. In another example, you could use the loader component in an application that displays photos. Use Loader.load(), Loader.percentLoaded, and Loader.complete to control the timing of the image loads and display progress bars to the user during loading.
If you load certain components into a SWF file or into the Loader component, the components may not work correctly. These components include the following: Alert, ComboBox, DateField, Menu, MenuBar, and Window.
Use the _lockroot property when calling loadMovie() or loading into the Loader component. If you're using the Loader component, add the following code:
myLoaderComponent.content._lockroot = true;
If you're using a movie clip with a call to loadMovie(), add the following code:
myMovieClip._lockroot = true;
If you don't set _lockroot to true in the loader movie clip, the loader only has access to its own library, but not the library in the loaded movie clip.
Flash Player 7 supports the _lockroot property. For information about this property, see the MovieClip._lockroot property in ActionScript 2.0 Language Reference.
Components such as Loader, ScrollPane and Window have events to determine when content has finished loading. So, if you want to set properties on the content of a Loader, ScrollPane, or Window, add the property statement within a "complete" event handler, as shown in the following example:
loadtest = new Object();
loadtest.complete = function(eventObject){
content_mc._rotation= 45;
}
my_loader.addEventListener("complete", loadtest)
For more information, see Loader.complete.
|
|
|
|