User Guide

ProgressBar component 605
To create an application with the ProgressBar component in polled mode:
1.
Drag a ProgressBar component from the Components panel to the Stage.
2.
In the Property inspector, do the following:
Enter the instance name pBar.
Select Polled for the mode parameter.
Enter loader for the source parameter.
3.
Select Frame 1 in the Timeline, open the Actions panel, and enter the following code, which
creates a Sound object called
loader and calls loadSound() to load a sound into the Sound
object:
var loader:Object = new Sound();
loader.loadSound("http://soundamerica.com/sounds/sound_fx/A-E/air.wav",
true);
In the following example, the progress bar is used in manual mode. In manual mode, you must set
the
maximum, minimum, and indeterminate properties in conjunction with the setProgress()
method to display progress. You do not set the
source property in manual mode.
To create an application with the ProgressBar component in manual mode:
1.
Drag a ProgressBar component from the Components panel to the Stage.
2.
In the Property inspector, do the following:
Enter the instance name pBar.
Select Manual for the mode parameter.
3.
Select Frame 1 in the Timeline, open the Actions panel, and enter the following code, which
updates the progress bar manually on every file download by using calls to
setProgress():
for(var:Number i=1; i <= total; i++){
// insert code to load file
pBar.setProgress(i, total);
}
Customizing the ProgressBar component
You can transform a ProgressBar component horizontally while authoring and at runtime. While
authoring, select the component on the Stage and use the Free Transform tool or any of the
Modify > Transform commands. At runtime, use
UIObject.setSize().
The progress bars left cap, right cap, and track graphic are set at a fixed size. When you resize a
progress bar, its middle portion is resized to fit between the two caps. If a progress bar is too small,
it may not render correctly.
Using styles with the ProgressBar component
You can set style properties to change the appearance of a progress bar instance. If the name of a
style property ends in “Color”, it is a color style property and behaves differently than noncolor
style properties. For more information, see “Using styles to customize component color and text
on page 67.