Packageqnx.ui.progress
Classpublic class ProgressBar
InheritanceProgressBar Inheritance SkinnableComponent Inheritance UIComponent Inheritance flash.display.MovieClip
Implements IProgress
Subclasses PercentageBar

The ProgressBar class shows progress by percentage:

A progress bar.

The ProgressBar class provides the temporal feedback functionality for the API. You can use the progress bar to show progress information for processor-intensive operations or to show progress information whenever data is being loaded. This feedback ensures the user that the operating system remains responsive during complex operations.

View the examples

See also

PercentageBar
ActivityIndicator


Public Properties
 PropertyDefined By
 Inheritedcontainment : String
Gets or sets a property that determines how a component is contained within a parent container.
UIComponent
  progress : Number
Gets or sets the current progress value as indicated by the progress bar.
ProgressBar
 Inheritedsize : Number
Gets or sets the size for this component (as a percentage of the container's size, or in pixels).
UIComponent
 InheritedsizeMode : String
Gets or sets the size mode for this component.
UIComponent
 InheritedsizeUnit : String
Gets or sets the unit of measure for the size property.
UIComponent
Public Methods
 MethodDefined By
  
Creates a new ProgressBar instance.
ProgressBar
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
drawNow():void
Calls the draw() method.
UIComponent
 Inherited
invalidate(property:String, invalidateNow:Boolean = false):void
Marks the property as invalid and the draw() method is called on the next frame or the next render, whichever comes first.
UIComponent
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
 Inherited
setSize(w:Number, h:Number):void
Sets the width and height of the component.
UIComponent
 Inherited
setSkin(cellSkin:Object):void
Set the skin object on the component for it to render.
SkinnableComponent
Protected Methods
 MethodDefined By
 Inherited
callLater(method:Function):void
Calls the specified method on the next frame or the next render, which ever happens first.
UIComponent
 Inherited
createInstance(linkage:Object):DisplayObject
Calling this method will attempt to create a DisplayObject instance based on the value of the linkage parameter.
UIComponent
 Inherited
draw():void
Called every time you set the width and height of the component.
UIComponent
 Inherited
isInvalid(property:String, ... properties):Boolean
Checks to see if the property is invalid and returns true if it is.
UIComponent
 Inherited
onAdded():void
Called when the instance is added to the stage.
UIComponent
 Inherited
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
 Inherited
setEnabled(val:Boolean):void
Called when the enabled property changes.
UIComponent
 Inherited
validate(property:String):void
Lets the component know that the specified property has been validated.
UIComponent
Property Detail
progressproperty
progress:Number

Gets or sets the current progress value as indicated by the progress bar. This property takes a value between 0 and 1.

For example, the following listing uses a counter to update the progress property. The counter value is divided by 100 in order to specify a percentage:

        private function handleTimerTick( e:TimerEvent ):void
        {
            counter++;
            myProgress.progress = counter/100;
        }
         


Implementation
    public function get progress():Number
    public function set progress(value:Number):void
Constructor Detail
ProgressBar()Constructor
public function ProgressBar()

Creates a new ProgressBar instance.

Examples
The following listing creates a ProgressBar instance. It contains a simple timer routine that is used to update the progress value.
package
{
    import flash.display.Sprite;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    import flash.text.TextFormat;
    
    import qnx.ui.progress.ProgressBar;
    
    [SWF(height="600", width="1024", 
    frameRate="30", backgroundColor="#FFFFFF")]
    public class myProgressSample extends Sprite
    {
        private var myProgress:ProgressBar;
        private var timer:Timer;
        private var counter:int;
        
        public function myProgressSample()
        {
            initializeUI();
        }
        
        private function initializeUI():void{
            
                        
            myProgress = new ProgressBar();
            myProgress.setPosition(400, 300);                
            myProgress.width = 200;    
            myProgress.height = 10;
            myProgress.progress = 0;            
            
            this.addChild(myProgress);
            
            // counter to keep track of how many times the timer has ticked
            counter = 0;
            timer  = new Timer(100,100);
            timer.addEventListener(TimerEvent.TIMER,handleTimerTick);
            timer.addEventListener(TimerEvent.TIMER_COMPLETE,handleTimerComplete);
            timer.start();
            
        }
        
        private function handleTimerComplete(e:TimerEvent):void
        {
            timer.removeEventListener(TimerEvent.TIMER,handleTimerTick);
            timer.removeEventListener(TimerEvent.TIMER_COMPLETE,handleTimerComplete);
            counter = 0;
        }
        
        private function handleTimerTick( e:TimerEvent ):void
        {
            counter++;
            myProgress.progress = counter/100;
        }
        
    }
}