| Package | qnx.ui.progress |
| Class | public class ActivityIndicator |
| Inheritance | ActivityIndicator SkinnableComponent UIComponent flash.display.MovieClip |
ActivityIndicator class provides visual progress feedback to the user during time-consuming operations. The
ActivityIndicator indicator animation appears as a rotating circle:
It's a good idea to use an activity indicator during load operations or when performing time-sensitive, processor-intensive operations.
See also
| Method | Defined By | ||
|---|---|---|---|
Creates a new ActivityIndicator instance. | ActivityIndicator | ||
animate(doAnimate:Boolean):void
Starts or stops the indicator animation. | ActivityIndicator | ||
![]() | destroy():void
Call this method when you want to have your object collected by the garbage collector. | UIComponent | |
![]() | drawNow():void
Calls the draw() method. | UIComponent | |
![]() | 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 | |
isAnimating():Boolean
Returns a Boolean that indicates whether or not the animation is currently playing. | ActivityIndicator | ||
![]() | setPosition(x:Number, y:Number):void
Sets the x and y position of the component. | UIComponent | |
![]() | setSize(w:Number, h:Number):void
Sets the width and height of the component. | UIComponent | |
![]() | setSkin(cellSkin:Object):void
Set the skin object on the component for it to render. | SkinnableComponent | |
| ActivityIndicator | () | Constructor |
public function ActivityIndicator()
Creates a new ActivityIndicator instance.
| animate | () | method |
public function animate(doAnimate:Boolean):voidStarts or stops the indicator animation.
Parameters
doAnimate:Boolean — true to start, or continue displaying the animation, false to stop animating.
|
| isAnimating | () | method |
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 );
}
}
Boolean — Returns true if the animation is currently running, otherwise false.
|
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 );
}
}
}
}