User Guide

996 ProgressBar component
To create an application with the ProgressBar component in manual mode
(example 3):
1. Drag a ProgressBar component onto the Stage and give it an instance name my_pb.
2. Select the my_pb ProgressBar on the Stage and, in the Property inspector, set the
component's mode parameter to "manual".
3. Select Frame 1 in the Timeline, and add the following ActionScript in the Actions panel:
var img_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadProgress = function(target_mc:MovieClip,
numBytesLoaded:Number, numBytesTotal:Number) {
my_pb.setProgress(numBytesLoaded, numBytesTotal);
};
mclListener.onLoadComplete = function(target_mc:MovieClip) {
//my_pb._visible = false;
};
img_mcl.addListener(mclListener);
this.createEmptyMovieClip("image_mc", 20);
img_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg",
image_mc);
4.
Press Control+Enter to test.
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 bar’s 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” in Using Components.
NOTE
You can uncomment the line //my_pb._visible = false; if you want to hide the
component after the content loads.