Packagesystem.process
Classpublic class CountDown
InheritanceCountDown Inheritance CoreAction Inheritance Task Inheritance Object
Implements Resetable, Resumable, Serializable, Startable, Stoppable

A countdown is a sequence of counting backward to indicate the seconds, days, or other time units remaining before an event occurs or a deadline expires. The CountDown objects defines a delay in millisecond and a maximal counter value for run the count down process.

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 ;
                     }
                 }
             }
         }
     }
     
               



Public Properties
 PropertyDefined By
 InheritedchangeIt : Signaler
This signal emit when the notifyChanged method is invoked.
CoreAction
 InheritedclearIt : 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
 InheritedfinishIt : Signaler
This signal emit when the notifyFinished method is invoked.
Task
 InheritedinfoIt : Signaler
This signal emit when the notifyInfo method is invoked.
CoreAction
 Inheritedlogger : Logger
Determinates the internal Logger reference of this Loggable object.
Task
 Inheritedlooping : Boolean
The flag to determinate if the Action object is looped.
CoreAction
 InheritedloopIt : Signaler
This signal emit when the notifyLooped method is invoked.
CoreAction
  maxCount : uint
Determinates the number of seconds to countdown.
CountDown
 InheritedpauseIt : Signaler
This signal emit when the notifyPause method is invoked.
CoreAction
 Inheritedphase : String
[read-only] The current phase of the action.
Task
 InheritedprogressIt : Signaler
This signal emit when the notifyProgress method is invoked.
CoreAction
 InheritedresumeIt : Signaler
This signal emit when the notifyResumed method is invoked.
CoreAction
 Inheritedrunning : Boolean
[read-only] Indicates true if the process is in progress.
Task
 InheritedstartIt : Signaler
This signal emit when the notifyStarted method is invoked.
Task
 InheritedstopIt : Signaler
This signal emit when the notifyStopped method is invoked.
CoreAction
  stopped : Boolean
[read-only] Indicates if the task is stopped.
CountDown
 InheritedtimeoutIt : Signaler
This signal emit when the notifyTimeOut method is invoked.
CoreAction
Public Methods
 MethodDefined By
  
CountDown(maxCount:uint = 0, delay:Number = 1000)
Creates a new CountDown instance.
CountDown
  
clone():*
[override] Returns a shallow copy of this object.
CountDown
 Inherited
isLocked():Boolean
Returns true if the object is locked.
Task
 Inherited
lock():void
Locks the object.
Task
 Inherited
Notify when the process is changed.
CoreAction
 Inherited
Notify when the process is cleared.
CoreAction
 Inherited
Notify an ActionEvent when the process is finished.
Task
 Inherited
notifyInfo(info:*):void
Notify a specific information when the process is changed.
CoreAction
 Inherited
Notify when the process is looped.
CoreAction
 Inherited
Notify when the process is paused.
CoreAction
 Inherited
Notify when the process is in progress.
CoreAction
 Inherited
Notify when the process is resumed.
CoreAction
 Inherited
Notify an ActionEvent when the process is started.
Task
 Inherited
Notify when the process is stopped.
CoreAction
 Inherited
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
 Inherited
unlock():void
Unlocks the display.
Task
Protected Methods
 MethodDefined By
 Inherited
setRunning(b:Boolean):void
Changes the running property value.
Task
Property Detail
countproperty
count:uint  [read-only]

The countdown number of times the timer has fired since it started at maxCount to zero.


Implementation
    public function get count():uint
delayproperty 
delay:Number

The optional delay to countdown (default 1000 ms)


Implementation
    public function get delay():Number
    public function set delay(value:Number):void
maxCountproperty 
maxCount:uint

Determinates the number of seconds to countdown.


Implementation
    public function get maxCount():uint
    public function set maxCount(value:uint):void
stoppedproperty 
stopped:Boolean  [read-only]

Indicates if the task is stopped.


Implementation
    public function get stopped():Boolean
Constructor Detail
CountDown()Constructor
public function CountDown(maxCount:uint = 0, delay:Number = 1000)

Creates a new CountDown instance.

Parameters
maxCount:uint (default = 0) — The number of seconds to countdown.
 
delay:Number (default = 1000) — The optional delay to countdown (default 1000 ms)
Method Detail
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():void

Reset the process.

resume()method 
public function resume():void

Resume the process.

run()method 
override public function run(... arguments):void

Run the process.

Parameters

... arguments

start()method 
public function start():void

Start the process.

stop()method 
public function stop():void

Stop the process.

toSource()method 
public function toSource(indent:int = 0):String

Returns the String source representation of the object.

Parameters

indent:int (default = 0)

Returns
String — a string representation the source code of the object.
toString()method 
public function toString():String

Returns the string representation of this instance.

Returns
String — the string representation of this instance.