Example
The following code creates a progress bar and a Loader component. It then creates a load
listener object with a
is registered with the
import mx.controls.Loader;
import mx.controls.ProgressBar;
this.createClassObject(ProgressBar, "my_pb", 998);
this.createClassObject(Loader, "my_ldr", 999);
my_pb.move(1, 1);
my_ldr.move(1, 50);
my_pb.source = "my_ldr";
var loadListener:Object = new Object();
loadListener.progress = function(eventObj){
// eventObj.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", loadListener);
my_ldr.contentPath = "http://www.flash-mx.com/images/image2.jpg";
See also
Loader.bytesLoaded
Loader.complete
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
Usage 1:
var listenerObject:Object = new Object();
listenerObject.complete = function(eventObj:Object){
// ...
};
loaderInstance.addEventListener("complete", listenerObject);
Usage 2:
on (complete) {
// ...
}
event handler that shows the progress of the load. The listener
progress
instance, as follows:
my_ldr
Loader.complete
823
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers