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.

Example

The following code creates a progress bar and a Loader component. It then creates a load listener object with a progress event handler that shows the progress of the load. The listener is registered with the my_ldr instance, as follows:

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