User Guide
496 Chapter 6: Components Dictionary
Example
The following code creates a Loader instance and then creates a listener object with an event
handler for the
progress event that sends a message to the Output panel telling what percent of
the content has loaded:
createClassObject(mx.controls.Loader, "loader", 0);
loadListener = new Object();
loadListener.progress = function(eventObj){
// eventObj.target is the component that generated the progress event,
// that is, the loader
trace("logo.swf is " + loader.percentLoaded + "% loaded."); // track loading
progress
}
loader.addEventListener("progress", loadListener);
loader.contentPath = "logo.swf";
Loader.scaleContent
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX 2004.
Usage
loaderInstance.scaleContent
Description
Property; indicates whether the content scales to fit the loader (true), or the loader scales to fit the
content (
false). The default value is true.
Example
The following code tells the loader to resize itself to match the size of its content:
loader.scaleContent = false;