The following example shows how you can manually set an ActionScript 3.0 ProgressBar control’s value by setting the progress bar’s mode property to the static ProgressBarMode.MANUAL constant and calling the setProgress() method.

Full code after the jump.

// ActionScript 3.0
/* Requires:
 * - ProgressBar control in Library
 * - Slider control in Library
 */
import fl.controls.ProgressBar;
import fl.controls.ProgressBarMode;
import fl.controls.Slider;
import fl.events.SliderEvent;
 
var slider:Slider = new Slider();
slider.minimum = 0;
slider.maximum = 100;
slider.liveDragging = true;
slider.move(10, 10);
slider.addEventListener(SliderEvent.CHANGE, slider_change);
addChild(slider);
 
var progressBar:ProgressBar = new ProgressBar();
progressBar.mode = ProgressBarMode.MANUAL;
progressBar.setSize(300, 100);
progressBar.move(100, 100);
addChild(progressBar);
 
function slider_change(evt:SliderEvent):void {
    progressBar.setProgress(evt.value, slider.maximum);
}
Tagged with:
 

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Spam Protection by WP-SpamFree