User Guide
604 Chapter 6: Components Dictionary
labelPlacement indicates the position of the label in relation to the progress bar. This parameter
can be one of the following values:
top, bottom, left, right, center. The default value is bottom.
conversion is a number by which to divide the %1 and %2 values in the label string before they
are displayed. The default value is 1.
You can write ActionScript to control these and additional options for the ProgressBar
component using its properties, methods, and events. For more information, see “ProgressBar
class” on page 607.
Creating an application with the ProgressBar component
The following procedure explains how to add a ProgressBar component to an application while
authoring. In this example, the progress bar is used in event mode. In event mode, the loading
content must emit
progress and complete events that the progress bar uses to display progress.
(These events are emitted by the Loader component. For more information, see “Loader
component” on page 484.)
To create an application with the ProgressBar component in event 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 Event for the mode parameter.
3.
Drag a Loader component from the Components panel to the Stage.
4.
In the Property inspector, enter the instance name loader.
5.
Select the progress bar on the Stage and, in the Property inspector, enter loader for the
source parameter.
6.
Select Frame 1 in the Timeline, open the Actions panel, and enter the following code, which
loads a JPEG file into the Loader component:
loader.autoLoad = false;
loader.contentPath = "http://imagecache2.allposters.com/images/86/
017_PP0240.jpg";
pBar.source = loader;
// loading does not start until load() is invoked
loader.load();
In the following example, the progress bar is used in polled mode. In polled mode, the
ProgressBar uses the
getBytesLoaded() and getBytesTotal() methods of the source object to
display its progress.