qnx.ui.progress.ActivityIndicator

ActivityIndicator

Properties | Methods | Examples


Packageqnx.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

ActivityIndicatorSkin
ProgressBar
PercentageBar



Public Properties

 PropertyDefined By
 Inheritedcontainment : String
Gets or sets a property that determines how a component is contained within a parent container.
UIComponent
 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 ActivityIndicator instance.
ActivityIndicator
  
animate(doAnimate:Boolean):void
Starts or stops the indicator animation.
ActivityIndicator
 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 = all, 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
  
isAnimating():Boolean
Returns a Boolean that indicates whether or not the animation is currently playing.
ActivityIndicator
 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 = all):void
Lets the component know that the specified property has been validated.
UIComponent

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.

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.Event;
    import flash.events.MouseEvent;
    
    import qnx.ui.buttons.LabelButton;
    import qnx.ui.progress.ActivityIndicator;
    
    [SWF(height="600", width="1024", frameRate="30",
     backgroundColor="#FFFFFF")]
    public class ActivityIndicatorSample extends Sprite
    {
        private var myActivity:ActivityIndicator;
        private var myAnimate:LabelButton;
        
        
        public function ActivityIndicatorSample()
        {
            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 );
            }    
        }
    }
}