Loader.bytesLoaded

Availability

Flash Player 6.0.79.

Edition

Flash MX 2004.

Usage

loaderInstance.bytesLoaded

Description

Property (read-only); the number of bytes of content that have been loaded. The default value is 0 until content begins loading.

Example

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

createClassObject(mx.controls.ProgressBar, "pBar", 0);
createClassObject(mx.controls.Loader, "loader", 1);
loadListener = new Object();
loadListener.progress = function(eventObj){
  // eventObj.target is the component which generated the change event,
  // i.e., the Loader.
  pBar.setProgress(loader.bytesLoaded, loader.bytesTotal); // show progress
}
loader.addEventListener("progress", loadListener);
loader.content = "logo.swf";

When you create an instance with the createClassObject() method, you have to position it on Stage with the move() and setSize() methods. See UIObject.move() and UIObject.setSize().

See also

Loader.bytesTotal, UIObject.createClassObject()