ProgressBar.value

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

progressBarInstance.value

Description

Property (read-only); indicates the amount of progress that has been made. This property is a number between the value of ProgressBar.minimum and ProgressBar.maximum. The default value is 0.

Example

The following example loads an image into a Loader component and marks the progress with the a progress bar. When the loading is complete, the example displays the minimum, maximum, and current values for the progress bar.

Drag an instance of the ProgressBar component onto the Stage, and enter the instance name my_pb in the Property inspector. Drag an instance of the Loader component onto the Stage, and enter the instance name my_ldr in the Property inspector. Add the following code to Frame 1 of the timeline:

/**
 Requires:
  - Loader component instance on Stage (instance name: my_ldr)
  - Progress component instance on Stage (instance name: my_pb)
*/

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

var my_ldr:mx.controls.Loader;
var my_pb:mx.controls.ProgressBar;

my_pb.mode = "polled";
my_pb.source = my_ldr;
my_ldr.autoLoad = false;


//Create Listener Object
var pbListener:Object = new Object();
pbListener.complete = function(evt_obj:Object){
  // event_obj.target is the component that generated the complete event,
  // i.e., the progress bar.
    trace("Minimum value is: " + evt_obj.target.minimum + " bytes");
    trace("Maximum value is: " + evt_obj.target.maximum + " bytes");
    trace("Current ProgressBar value = " + evt_obj.target.value + " bytes");
}
//Add Listener
my_pb.addEventListener("complete", pbListener);

// when autoLoad is false loading does not start until load() is invoked
my_ldr.load("http://www.helpexamples.com/flash/images/image1.jpg");