User Guide

Loader.content 825
trace("loading complete");
}
//Add listener.
my_ldr.addEventListener("complete", loaderListener);
my_ldr.load("http://www.flash-mx.com/images/image2.jpg");
Loader.content
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
loaderInstance.content
Description
Property (read-only); a reference to a movie clip instance that contains the contents of the
loaded file. The value is
undefined until the load begins. Set properties for the content
within an event handler function for the
Loader.complete event.
Example
The Loader component has a “complete” event so you can make sure the content is
completely loaded before trying to access properties of the loaders content.
The following example uses the
Loader.content property within an event handler function
for the complete event. Drag a Loader component from the Components panel to the current
documents library, so the component appears in the library. Then add the following
ActionScript to the first frame of the main timeline:
this.createClassObject(mx.controls.Loader, "my_ldr", 10);
my_ldr.contentPath = "http://www.flash-mx.com/images/image1.jpg";
//Assign a variable to the content.
var content_mc:MovieClip = my_ldr.content;
var loadtest:Object = new Object();
loadtest.complete = function(){
//Set properties for the content.
content_mc._alpha = 50;
content_mc._rotation= 45;
trace(content_mc._width);
}
my_ldr.addEventListener("complete", loadtest);