Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 180

Programming actionscript 3.0
Table of Contents

Advertisement

The LoaderInfo class
Once the file has loaded, a LoaderInfo object is created. This object is a property of both the
Loader object and the loaded display object. The LoaderInfo object is a property of the
Loader object through the
of the loaded display object through the display object's
property of the loaded display object refers to the same LoaderInfo object as the
loaderInfo
contentLoaderInfo
shared between a loaded object and the Loader object that loaded it (between loader and
loadee).
The LoaderInfo class provides information such as load progress, the URLs of the loader and
loadee, the number of bytes total for the media, and the nominal height and width of the
media. A LoaderInfo object also dispatches events for monitoring the progress of the load.
In order to access properties of loaded content, you will want to add an event listener to the
LoaderInfo object, as in the following code:
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
var ldr:Loader = new Loader();
var urlReq:URLRequest = new URLRequest("Circle.swf");
ldr.load(urlReq);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
addChild(ldr);
function loaded(event:Event):void
{
var content:Sprite = event.target.content;
content.scaleX = 2;
}
For more information, see
180
Display Programming
contentLoaderInfo
property of the Loader object. In other words, a LoaderInfo object is
Chapter 13, "Handling Events," on page
property of the Loader object. It is a property
loaderInfo
345.
property. The

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents