| Package | system.process |
| Class | public class CountDown |
| Inheritance | CountDown CoreAction Task Object |
| Implements | Resetable, Resumable, Serializable, Startable, Stoppable |
Example :
package examples
{
import system.process.Action;
import system.process.CountDown;
import flash.display.Sprite;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class CountDownExample extends Sprite
{
public function CountDownExample()
{
stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
counter = new CountDown( 5 ) ;
counter.changeIt.connect( change ) ;
counter.finishIt.connect( finish ) ;
counter.pauseIt.connect( change ) ;
counter.resumeIt.connect( resume ) ;
counter.startIt.connect( start ) ;
counter.stopIt.connect( stop ) ;
counter.run() ;
}
//////////
public var counter:CountDown ;
//////////
public function change( action:Action ):void
{
trace( "change count:" + counter.count ) ;
}
public function finish( action:Action ):void
{
trace( "finish count:" + counter.count ) ;
}
public function pause( action:Action ):void
{
trace( "pause count:" + counter.count ) ;
}
public function resume( action:Action ):void
{
trace( "resume count:" + counter.count ) ;
}
public function start( action:Action ):void
{
trace( "start count:" + counter.count ) ;
}
public function stop( action:Action ):void
{
trace( "stop count:" + counter.count ) ;
}
//////////
private function keyDown( e:KeyboardEvent ):void
{
var code:uint = e.keyCode ;
switch( code )
{
case Keyboard.UP :
{
counter.stop() ;
break ;
}
case Keyboard.DOWN :
{
if( counter.stopped )
{
counter.resume() ;
}
else
{
counter.start() ;
}
break ;
}
case Keyboard.SPACE :
{
counter.reset() ;
break ;
}
}
}
}
}
| Property | Defined By | ||
|---|---|---|---|
![]() | changeIt : Signaler
This signal emit when the notifyChanged method is invoked. | CoreAction | |
![]() | clearIt : Signaler
This signal emit when the notifyCleared method is invoked. | CoreAction | |
| count : uint [read-only]
The countdown number of times the timer has fired since it started at maxCount to zero. | CountDown | ||
| delay : Number
The optional delay to countdown (default 1000 ms)
| CountDown | ||
![]() | finishIt : Signaler
This signal emit when the notifyFinished method is invoked. | Task | |
![]() | infoIt : Signaler
This signal emit when the notifyInfo method is invoked. | CoreAction | |
![]() | logger : Logger
Determinates the internal Logger reference of this Loggable object. | Task | |
![]() | looping : Boolean
The flag to determinate if the Action object is looped. | CoreAction | |
![]() | loopIt : Signaler
This signal emit when the notifyLooped method is invoked. | CoreAction | |
| maxCount : uint
Determinates the number of seconds to countdown. | CountDown | ||
![]() | pauseIt : Signaler
This signal emit when the notifyPause method is invoked. | CoreAction | |
![]() | phase : String [read-only]
The current phase of the action. | Task | |
![]() | progressIt : Signaler
This signal emit when the notifyProgress method is invoked. | CoreAction | |
![]() | resumeIt : Signaler
This signal emit when the notifyResumed method is invoked. | CoreAction | |
![]() | running : Boolean [read-only]
Indicates true if the process is in progress. | Task | |
![]() | startIt : Signaler
This signal emit when the notifyStarted method is invoked. | Task | |
![]() | stopIt : Signaler
This signal emit when the notifyStopped method is invoked. | CoreAction | |
| stopped : Boolean [read-only]
Indicates if the task is stopped. | CountDown | ||
![]() | timeoutIt : Signaler
This signal emit when the notifyTimeOut method is invoked. | CoreAction | |
| Method | Defined By | ||
|---|---|---|---|
CountDown(maxCount:uint = 0, delay:Number = 1000)
Creates a new CountDown instance. | CountDown | ||
clone():* [override]
Returns a shallow copy of this object. | CountDown | ||
![]() | isLocked():Boolean
Returns true if the object is locked. | Task | |
![]() | lock():void
Locks the object. | Task | |
![]() | notifyChanged():void
Notify when the process is changed. | CoreAction | |
![]() | notifyCleared():void
Notify when the process is cleared. | CoreAction | |
![]() | notifyFinished():void
Notify an ActionEvent when the process is finished. | Task | |
![]() | notifyInfo(info:*):void
Notify a specific information when the process is changed. | CoreAction | |
![]() | notifyLooped():void
Notify when the process is looped. | CoreAction | |
![]() | notifyPaused():void
Notify when the process is paused. | CoreAction | |
![]() | notifyProgress():void
Notify when the process is in progress. | CoreAction | |
![]() | notifyResumed():void
Notify when the process is resumed. | CoreAction | |
![]() | notifyStarted():void
Notify an ActionEvent when the process is started. | Task | |
![]() | notifyStopped():void
Notify when the process is stopped. | CoreAction | |
![]() | notifyTimeOut():void
Notify when the process is out of time. | CoreAction | |
reset():void
Reset the process. | CountDown | ||
resume():void
Resume the process. | CountDown | ||
run(... arguments):void [override]
Run the process. | CountDown | ||
start():void
Start the process. | CountDown | ||
stop():void
Stop the process. | CountDown | ||
toSource(indent:int = 0):String
Returns the String source representation of the object. | CountDown | ||
toString():String
Returns the string representation of this instance. | CountDown | ||
![]() | unlock():void
Unlocks the display. | Task | |
| count | property |
count:uint [read-only] The countdown number of times the timer has fired since it started at maxCount to zero.
public function get count():uint| delay | property |
delay:NumberThe optional delay to countdown (default 1000 ms)
public function get delay():Number public function set delay(value:Number):void| maxCount | property |
maxCount:uintDeterminates the number of seconds to countdown.
public function get maxCount():uint public function set maxCount(value:uint):void| stopped | property |
stopped:Boolean [read-only] Indicates if the task is stopped.
public function get stopped():Boolean| CountDown | () | Constructor |
public function CountDown(maxCount:uint = 0, delay:Number = 1000)Creates a new CountDown instance.
ParametersmaxCount:uint (default = 0) — The number of seconds to countdown.
| |
delay:Number (default = 1000) — The optional delay to countdown (default 1000 ms)
|
| clone | () | method |
override public function clone():*Returns a shallow copy of this object.
Returns* — a shallow copy of this object.
|
| reset | () | method |
public function reset():voidReset the process.
| resume | () | method |
public function resume():voidResume the process.
| run | () | method |
override public function run(... arguments):voidRun the process.
Parameters
... arguments |
| start | () | method |
public function start():voidStart the process.
| stop | () | method |
public function stop():voidStop the process.
| toSource | () | method |
public function toSource(indent:int = 0):StringReturns the String source representation of the object.
Parameters
indent:int (default = 0) |
String — a string representation the source code of the object.
|
| toString | () | method |
public function toString():StringReturns the string representation of this instance.
ReturnsString — the string representation of this instance.
|