ProgressBar.mode

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

progressBarInstance.mode

Description

Property; the mode in which the progress bar loads content. This value can be "event", "polled", or "manual".

Event mode and polled mode are the most common modes. In event mode, the source property specifies loading content that emits progress and complete events; you should use a Loader object in this mode. In polled mode, the source property specifies loading content (such as a MovieClip object) that exposes getBytesLoaded() and getsBytesTotal() methods. Any object that exposes these methods can be used as a source in polled mode (including a custom object or the root timeline).

You can also use the ProgressBar component in manual mode by manually setting the maximum, minimum, and indeterminate properties and making calls to the ProgressBar.setProgress() method.

Example

The following example loads an image into a loader and marks the progress of loading with a progress bar that is set to event mode. When the load is complete, a listener for the complete event displays the name of the loader object.

You must first drag a Loader component and a ProgressBar component from the Components panel to the current document's library; then add the following code to Frame 1 of the main timeline:

/**
 Requires:
  - ProgressBar component in library
  - Loader component in library
*/

System.security.allowDomain("http://www.helpexamples.com");

this.createClassObject(mx.controls.ProgressBar, "my_pb", 10);
this.createClassObject(mx.controls.Loader, "my_ldr", 20);

//Create Listener Object
var ldrListener:Object = new Object();
ldrListener.complete = function(evt_obj:Object) {
    trace("Event complete for " + evt_obj.target);
};
//Add Listener
my_ldr.addEventListener("complete", ldrListener);

//Set progress bar settings
my_pb.mode = "event";
my_pb.indeterminate = true;
my_pb.source = my_ldr;

//Set loader settings
my_ldr.move(0,30);
my_ldr.autoLoad = false;
my_ldr.scaleContent = false;
my_ldr.load("http://www.helpexamples.com/flash/images/image1.jpg");