User Guide
822 Loader component
When you create an instance with createClassObject(), you have to position it on the
Stage with
move(). See UIObject.move().
import mx.controls.Loader;
import mx.controls.ProgressBar;
System.security.allowDomain("http://www.flash-mx.com");
this.createClassObject(Loader, "my_ldr", 10);
this.createClassObject(ProgressBar, "my_pb", 20, {source:"my_ldr"});
my_ldr.move(1, 50);
my_pb.move(1, 1);
var loaderListener:Object = new Object();
loaderListener.progress = function(evt_obj:Object) {
// evt_obj.target is the component that generated the progress event,
// that is, the loader.
my_pb.setProgress(my_ldr.bytesLoaded, my_ldr.bytesTotal);
// Show progress.
};
my_ldr.addEventListener("progress", loaderListener);
my_ldr.contentPath = "http://www.flash-mx.com/images/image2.jpg";
Loader.bytesTotal
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
loaderInstance.bytesTotal
Description
Property (read-only); the size of the content, in bytes. The default value is 0 until content
begins loading.