qnx.fuse.ui.progress.ActivityIndicator

ActivityIndicator

Properties | Methods | Examples


Packageqnx.fuse.ui.progress
Classpublic class ActivityIndicator
InheritanceActivityIndicator Inheritance SkinnableComponent Inheritance UIComponent Inheritance flash.display.MovieClip

The ActivityIndicator class provides visual progress feedback to the user during time-consuming operations. The ActivityIndicator indicator animation appears as a rotating circle:

The activity indicator.

It's a good idea to use an activity indicator during load operations or when performing time-sensitive, processor-intensive operations.



Class information:
PlayBook Tablet OS Version:   1.0.6

View the examples

See also

ProgressBar
PercentageBar



Public Properties

 PropertyDefined By
 InheritedexplicitHeight : Number
[read-only] Returns the explicit height (actual height, in pixels) of the UI component.
UIComponent
 InheritedexplicitWidth : Number
[read-only] Returns the explicit width (actual width, in pixels) of the UI component.
UIComponent
 InheritedincludeInLayout : Boolean
Specifies whether or not the component should be included in its parent container's layout.
UIComponent
 InheritedlayoutData : Object
Returns the layout data for the object.
UIComponent
 InheritedminHeight : Number
Gets or sets the minimum preferred height of the control.
UIComponent
 InheritedminWidth : Number
Gets or sets the minimum preferred width of the control.
UIComponent
 Inheritedstate : String
Gets or sets the state of the component.
SkinnableComponent

Public Methods

 MethodDefined By
  
Creates a new ActivityIndicator instance.
ActivityIndicator
  
animate(doAnimate:Boolean):void
Starts or stops the indicator animation.
ActivityIndicator
 Inherited
childChanged(resizedChild:DisplayObject = null):Boolean
Notifies the UIComponent that one or more of its children has changed in a manner that may affect this object's layout.
UIComponent
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
Returns the size options for the given control.
UIComponent
 Inherited
Calling this method results in a call to the components validateDisplayList() method before the display list is rendered.
UIComponent
 Inherited
Calling this method results in a call to the components validateProperties() method before the display list is rendered.
UIComponent
  
isAnimating():Boolean
Returns a Boolean that indicates whether or not the animation is currently playing.
ActivityIndicator
 Inherited
measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
This method calls doMeasure() in order to calculate the preferred size of the control.
UIComponent
 Inherited
setActualSize(w:Number, h:Number):void
Sets the width and height of the object without setting the explicitWidth and explicitHeight.
UIComponent
 Inherited
setLayoutBounds(bounds:Rectangle):void
Sets the receiver's size and location to the rectangular area specified by the arguments.
UIComponent
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
 Inherited
setSkin(newSkin:Object):void
Set the skin object on the component for it to render.
SkinnableComponent
 Inherited
Validates the display list of the component by calling the updateDisplayList().
UIComponent
 Inherited
Validates the component immediately by calling validateProperties(), validateSizes(), and validateDisplayList() if necessary.
UIComponent
 Inherited
Validates the properties of the component by calling the commitProperties() method.
UIComponent

Protected Methods

 MethodDefined By
 Inherited
Process properties of the component.
UIComponent
  
[override]
ActivityIndicator
 Inherited
doMeasure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
Performs a measurement on the control, and returns a LayoutMeasurement instance containing the available width and height within the layout.
UIComponent
 Inherited
flushCache():void
Invoked as part of parentLayoutChanged.
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
Invalidates the parent's size and display list if includeInLayout property is set to true.
UIComponent
 Inherited
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Sets the size and position of the children of the component.
UIComponent
 Inherited
updateSkin(unscaledWidth:Number, unscaledHeight:Number):void
Updates the skin.
SkinnableComponent

Constructor Detail

ActivityIndicator()


public function ActivityIndicator()

Creates a new ActivityIndicator instance.

Method Detail

animate()


public function animate(doAnimate:Boolean):void

Starts or stops the indicator animation.

Parameters

doAnimate:Booleantrue to start, or continue displaying the animation, false to stop animating.

commitState()


override protected function commitState():void

isAnimating()


public function isAnimating():Boolean

Returns a Boolean that indicates whether or not the animation is currently playing.

The following example uses the isAnimating method to toggle the animate property of an ActivityIndicator instance.

            private function onClick( e:MouseEvent ):void
            {
                if ( !myActivity.isAnimating() )
                {
                    myAnimate.label = "Stop";
                    myActivity.animate( true );
                }
                else 
                {
                    myAnimate.label = "Animate";
                    myActivity.animate( false );
                }
            }
         

Returns

Boolean — Returns true if the animation is currently running, otherwise false.

Examples

In the following example, a LabelButton instance is used to toggle the animation property of an activity indicator
package
{
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    
    import qnx.fuse.ui.buttons.LabelButton;
    import qnx.fuse.ui.progress.ActivityIndicator;
    
    [SWF(height="600", width="1024", frameRate="30",
        backgroundColor="#FFFFFF")]
    public class ActivityIndSample extends Sprite
    {
        private var myActivity:ActivityIndicator;
        private var myAnimate:LabelButton;
        
        public function ActivityIndSample()
        {
            initializeUI();
        }
        
        private function initializeUI():void
        {
            myActivity = new ActivityIndicator();            
            myActivity.setPosition( 260, 225 );
            this.addChild( myActivity );
            
            myAnimate = new LabelButton();
            myAnimate.setPosition( 200, 300 );
            myAnimate.label = "Animate";
            myAnimate.width = 150;
            this.addChild( myAnimate );
            
            myAnimate.addEventListener( MouseEvent.CLICK, onClick );    
        }
        
        private function onClick( e:MouseEvent ):void
        {
            if ( !myActivity.isAnimating() )
            {
                myAnimate.label = "Stop";
                myActivity.animate( true );
            }
            else 
            {
                myAnimate.label = "Animate";
                myActivity.animate( false );
            }    
        }
    }
}