ProgressBar.source

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

progressBarInstance.source

Description

Property; a reference to the instance to be loaded whose loading process will be displayed. The loading content should emit a progress event from which the current and total values are retrieved. This property is used only when ProgressBar.mode is set to "event" or "polled". The default value is undefined.

The ProgressBar component can be used with content within an application, including _root.

Example

The following example loads an image into a loader and marks the progress with a progress bar. The example sets the source property to the name of the Loader component (my_ldr) to associate the content with the progress bar.

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 pbListener:Object = new Object();
pbListener.complete = function(evt_obj:Object) {
 evt_obj.target.visible = false;
};
//Add Listener
my_pb.addEventListener("complete", pbListener);

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

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

See also

ProgressBar.mode