| Package | com.bourre.commands |
| Class | public class LoopCommand |
| Inheritance | LoopCommand AbstractSyncCommand AbstractCommand |
| Implements | ASyncCommandListener, Cancelable, Suspendable, TickListener |
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
LoopCommand wrap a loop statement within a command. Loop
are strecthed over time using functionnalities of a TickBeacon
object. According to the maximum execution time limit of this command
the maximum amout of iteration will be performed for each step since the
step execution time exceed the maximum execution time.
For informations and examples on these classes see the How to use LoopCommand and IterationCommand document.
See also
| Method | Defined by | ||
|---|---|---|---|
|
LoopCommand(command:IterationCommand, iterationLimit:Number)
Creates a new
LoopCommand object which will handle
the passed-in IterationCommand
| LoopCommand | ||
![]() |
addASyncCommandListener(listener:ASyncCommandListener, ... rest):Boolean
Adds the passed-in listener as listener for the
onCommandEnd
event of this command. | AbstractSyncCommand | |
|
addLoopCommandListener(listener:LoopCommandListener):Boolean
Adds the passed-in listener as listener for this command's events.
| LoopCommand | ||
|
cancel():void
Attempts to cancel execution of this task.
| LoopCommand | ||
|
execute(e:Event = null):void
Resets and then start the loop command process.
| LoopCommand | ||
![]() |
fireCommandEndEvent():void
Fires the
onCommandEnd event to the listeners
of this command. | AbstractSyncCommand | |
![]() |
Returns the exclusive logger object owned by the plugin.
| AbstractCommand | |
![]() |
getModel(key:String):AbstractModel
Returns a reference to the model
AbstractModel. | AbstractCommand | |
![]() |
Returns a reference to the owner of this command.
| AbstractCommand | |
![]() |
getView(key:String):AbstractView
Returns a reference to the view
AbstractView. | AbstractCommand | |
|
isCancelled():Boolean
Returns
true if the loop process have been
canceled by the user. | LoopCommand | ||
|
isDone():Boolean
Returns
true if the loop process have been
completed. | LoopCommand | ||
![]() |
isModelRegistered(key:String):Boolean
Check if a model
AbstractModel is registered
with passed key in owner's ModelLocator. | AbstractCommand | |
![]() |
isRunning():Boolean
Returns
true if this command is currently
processing. | AbstractSyncCommand | |
![]() |
isViewRegistered(key:String):Boolean
Check if a view
AbstractView is registered
with passed key in owner's ViewLocator. | AbstractCommand | |
|
onCommandEnd(e:Event):void
Called at the end of another loop command.
| LoopCommand | ||
|
onTick(e:Event = null):void
Process the loop.
| LoopCommand | ||
![]() |
removeASyncCommandListener(listener:ASyncCommandListener):Boolean
Removes the passed-in listener for listening
the
onCommandEnd event of this command. | AbstractSyncCommand | |
|
removeLoopCommandListener(listener:LoopCommandListener):Boolean
Removes the passed-in listener as listener for this command's events.
| LoopCommand | ||
|
reset():void
Resets the state of this command.
| LoopCommand | ||
![]() |
run():void
Implementation of the
Runnable interface,
a call to run() is equivalent to a call to
execute without argument. | AbstractSyncCommand | |
|
setFrameBeacon(beacon:TickBeacon):void
Defines on which beacon the loop command will perform
its operation.
| LoopCommand | ||
| LoopCommand | |||
|
start():void
Starts or restarts the loop process.
| LoopCommand | ||
|
stop():void
Stops the loop process.
| LoopCommand | ||
![]() |
toString():String
Returns the string representation of the object.
| AbstractSyncCommand | |
| Method | Defined by | ||
|---|---|---|---|
|
fireOnIterationEvent(i:Number, o:*):void
Fires the
onLoopStart event to the internal
IterationCommand. | LoopCommand | ||
|
fireOnLoopCancelEvent(n:Number):void
Fires the
onLoopCancel event to its listeners. | LoopCommand | ||
|
fireOnLoopEndEvent(n:Number):void
Fires the
onLoopEnd event to its listeners. | LoopCommand | ||
|
fireOnLoopProgressEvent(n:Number):void
Fires the
onLoopProgresst event to its listeners. | LoopCommand | ||
|
fireOnLoopStartEvent(n:Number):void
Fires the
onLoopStart event to its listeners. | LoopCommand | ||
|
fireOnLoopStopEvent(n:Number):void
Fires the
onLoopStop event to its listeners. | LoopCommand | ||
![]() |
firePrivateEvent(e:Event):void
Fires a private event directly on this command's owner.
| AbstractCommand | |
| Constant | Defined by | ||
|---|---|---|---|
| DEFAULT_ITERATION_TIME_LIMIT : Number = 15 [static]
Default execution time limit by loop iterations group
| LoopCommand | ||
| NO_LIMIT : Number = Infinity [static]
Defines an unlimited execution time for loop iterations.
| LoopCommand | ||
![]() | onCommandEndEVENT : String = "onCommandEnd" [static]
Name of the event dispatched at the end of the command's process.
| AbstractSyncCommand | |
| onLoopCancelEVENT : String = "onLoopCancel" [static]
Name of the event dispatched on user cancelation.
| LoopCommand | ||
| onLoopEndEVENT : String = "onLoopEnd" [static]
Name of the event dispatched at the end of the command's process.
| LoopCommand | ||
| onLoopProgressEVENT : String = "onLoopProgress" [static]
Name of the event dispatched at each step of computation.
| LoopCommand | ||
| onLoopStartEVENT : String = "onLoopStart" [static]
Name of the event dispatched at the start of the command's process.
| LoopCommand | ||
| onLoopStopEVENT : String = "onLoopStop" [static]
Name of the event dispatched at the stop of the command's process.
| LoopCommand | ||
| LoopCommand | () | constructor |
public function LoopCommand(command:IterationCommand, iterationLimit:Number)
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Creates a new LoopCommand object which will handle
the passed-in IterationCommand
command:IterationCommand — iteration command which will be called
during the loop, it also provide the
iterator the loop command will use
|
|
iterationLimit:Number — maximum execution time for each step of
the loop command process
|
| addLoopCommandListener | () | method |
public function addLoopCommandListener(listener:LoopCommandListener):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Adds the passed-in listener as listener for this command's events.
Parameterslistener:LoopCommandListener — listener to be added
|
Boolean |
| cancel | () | method |
public function cancel():void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Attempts to cancel execution of this task. This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when cancel is called, this task should never run.
After this method returns, subsequent calls to isRunning
will always return false. Subsequent calls to
run will always fail with an exception. Subsequent
calls to cancel will always failed with the throw
of an exception.
— IllegalStateException — if the cancel
method have been called wheras the operation have been already
cancelled
|
| execute | () | method |
public override function execute(e:Event = null):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Resets and then start the loop command process.
The command cannot be executed after a call to
the cancel method. If a call to
execute is done after the command be canceled
the function fail and throw an error
e:Event (default = null) — event object to initialise the command (not use)
|
— IllegalStateException — if the execute
method have been called wheras the operation have been already
cancelled
|
| fireOnIterationEvent | () | method |
protected function fireOnIterationEvent(i:Number, o:*):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Fires the onLoopStart event to the internal
IterationCommand.
i:Number — current iteration number
|
|
o:* — value retreived from the iterator next
method
|
| fireOnLoopCancelEvent | () | method |
protected function fireOnLoopCancelEvent(n:Number):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Fires the onLoopCancel event to its listeners.
n:Number — iterations performed until the cancelation
|
| fireOnLoopEndEvent | () | method |
protected function fireOnLoopEndEvent(n:Number):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Fires the onLoopEnd event to its listeners.
n:Number — iterations performed until the end
|
| fireOnLoopProgressEvent | () | method |
protected function fireOnLoopProgressEvent(n:Number):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Fires the onLoopProgresst event to its listeners.
n:Number — iterations performed until the call
|
| fireOnLoopStartEvent | () | method |
protected function fireOnLoopStartEvent(n:Number):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Fires the onLoopStart event to its listeners.
n:Number — iterations performed until the restart
|
| fireOnLoopStopEvent | () | method |
protected function fireOnLoopStopEvent(n:Number):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Fires the onLoopStop event to its listeners.
n:Number — iterations performed until the stop
|
| isCancelled | () | method |
public function isCancelled():Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns true if the loop process have been
canceled by the user.
Boolean — true if the loop process have been
canceled by the user
|
| isDone | () | method |
public function isDone():Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns true if the loop process have been
completed.
Boolean — true if the loop process have been
completed
|
| onCommandEnd | () | method |
public function onCommandEnd(e:Event):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Called at the end of another loop command.
The LoopCommand class implements
ASyncCommandListener in order to
provide a way to automatically chain several
commands together.
e:Event — event object dispatched by the asynchronous command
|
| onTick | () | method |
public function onTick(e:Event = null):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Process the loop. At each call of this function a real loop statement is performed until its execution time go past the maximum execution time defined for this command.
Parameterse:Event (default = null) — event object dispatched by the beacon
|
| removeLoopCommandListener | () | method |
public function removeLoopCommandListener(listener:LoopCommandListener):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Removes the passed-in listener as listener for this command's events.
Parameterslistener:LoopCommandListener — listener to be removed
|
Boolean |
| reset | () | method |
public function reset():void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Resets the state of this command. A loop command cannot be reset
while running. If a call to the reset is done
while the command is running, the call fail with an error.
— IllegalStateException — Can't reset an
operation currently running.
|
| setFrameBeacon | () | method |
public function setFrameBeacon(beacon:TickBeacon):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Defines on which beacon the loop command will perform its operation. It allow to the user to control the speed at which execution steps will be called.
Parametersbeacon:TickBeacon — beacon object onto which the command
will run
|
| setOwner | () | method |
public override function setOwner(owner:Plugin):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
owner:Plugin |
| start | () | method |
public function start():void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Starts or restarts the loop process.
The process can be started only if there is a valid
IterationCommand and if the command
haven't be canceled or completed.
— IllegalStateException — Can't start
a command which has no specified iteration command
|
|
— IllegalStateException — Can't start a
canceled or completed command
|
| stop | () | method |
public function stop():void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Stops the loop process. Command could be stop only when it is running.
| DEFAULT_ITERATION_TIME_LIMIT | constant |
public static const DEFAULT_ITERATION_TIME_LIMIT:Number = 15
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Default execution time limit by loop iterations group
| NO_LIMIT | constant |
public static const NO_LIMIT:Number = Infinity
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Defines an unlimited execution time for loop iterations.
| onLoopCancelEVENT | constant |
public static const onLoopCancelEVENT:String = "onLoopCancel"
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Name of the event dispatched on user cancelation.
| onLoopEndEVENT | constant |
public static const onLoopEndEVENT:String = "onLoopEnd"
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Name of the event dispatched at the end of the command's process.
| onLoopProgressEVENT | constant |
public static const onLoopProgressEVENT:String = "onLoopProgress"
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Name of the event dispatched at each step of computation.
| onLoopStartEVENT | constant |
public static const onLoopStartEVENT:String = "onLoopStart"
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Name of the event dispatched at the start of the command's process.
| onLoopStopEVENT | constant |
public static const onLoopStopEVENT:String = "onLoopStop"
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Name of the event dispatched at the stop of the command's process.