Skip to content
Dec 18 / Peter deHaan

Creating an indeterminate ProgressBar control in Flash using ActionScript 3.0

The following example shows how you can create an indeterminate Flash/ActionScript 3.0 ProgressBar control by setting the Boolean indeterminate property.

Full code after the jump.

// ActionScript 3.0
/* Requires:
 * - CheckBox control in Library
 * - ProgressBar control in Library
 */
import fl.controls.ButtonLabelPlacement;
import fl.controls.CheckBox;
import fl.controls.ProgressBar;
import fl.controls.ProgressBarMode;
 
var checkBox:CheckBox = new CheckBox();
checkBox.label = "indeterminate:";
checkBox.labelPlacement = ButtonLabelPlacement.LEFT;
checkBox.move(10, 10);
checkBox.addEventListener(Event.CHANGE, checkBox_change);
addChild(checkBox);
 
var progressBar:ProgressBar = new ProgressBar();
progressBar.indeterminate = checkBox.selected;
progressBar.setSize(300, 100);
progressBar.move(100, 100);
addChild(progressBar);
 
function checkBox_change(evt:Event):void {
    progressBar.indeterminate = checkBox.selected;
}
Leave a Comment