| Package | com.bourre.commands |
| Class | public class Batch |
| Inheritance | Batch AbstractCommand |
| Implements | MacroCommand |
| Subclasses | ReversedBatch |
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Batch object encapsulate a set of Commands
to execute at the same time.
Batch is a first-in first-out stack (FIFO) where commands are executed in the order they were registered.
When an event is passed to the execute method
it will be relayed to the sub-commands.
| Property | Defined by | ||
|---|---|---|---|
| _aCommands : Array
Contains all commands currently in this macro command
| Batch | ||
![]() | _owner : Plugin
A reference to the plugin owner of this command.
| AbstractCommand | |
| Method | Defined by | ||
|---|---|---|---|
|
Batch()
Batch object don't accept any arguments in the constructor.
| Batch | ||
|
addCommand(command:Command):Boolean
Adds a command in the batch stack.
| Batch | ||
|
Returns
true if the passed-in command is stored
in this batch. | Batch | ||
|
execute(e:Event = null):void
Executes the whole set of commands in the order they were
registered.
| Batch | ||
![]() |
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 | |
![]() |
isModelRegistered(key:String):Boolean
Check if a model
AbstractModel is registered
with passed key in owner's ModelLocator. | AbstractCommand | |
![]() |
isViewRegistered(key:String):Boolean
Check if a view
AbstractView is registered
with passed key in owner's ViewLocator. | AbstractCommand | |
|
process(f:Function, a:Array, ... args):void
[static]
Takes all elements of an Array and pass them one by one as arguments
to a method of an object.
| Batch | ||
|
removeAll():void
Removes all commands stored in the batch stack.
| Batch | ||
|
removeCommand(command:Command):Boolean
Removes all references to the passed-in command.
| Batch | ||
|
Defines the plugin owner of this command.
| Batch | ||
|
size():uint
Returns the number of commands stored in this batch.
| Batch | ||
![]() |
toString():String
Returns the string representation of this instance.
| AbstractCommand | |
| _aCommands | property |
protected var _aCommands:Array
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Contains all commands currently in this macro command
| Batch | () | constructor |
public function Batch()
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Batch object don't accept any arguments in the constructor.
| addCommand | () | method |
public function addCommand(command:Command):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Adds a command in the batch stack.
If the passed-in command have been added the
function return true.
There is no limitation on the number of references of the same command witch the batch can contain.
Parameterscommand:Command — command a Command to add at the end
of the current Batch
|
Boolean — true if the command could have been added,
either false
|
| contains | () | method |
public function contains(command:Command):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns true if the passed-in command is stored
in this batch.
command:Command — command object to look at
|
Boolean — true if the passed-in command is stored
in the Batch
|
| execute | () | method |
public override function execute(e:Event = null):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Executes the whole set of commands in the order they were registered.
If an event is passed to the function, it will be relayed
to the sub-commands execute method.
e:Event (default = null) — event object to relay to the sub-commands.
|
| process | () | method |
public static function process(f:Function, a:Array, ... args):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Takes all elements of an Array and pass them one by one as arguments to a method of an object. It's exactly the same concept as batch processing in audio or video software, when you choose to run the same actions on a group of files.
Basical example which sets _alpha value to .4 and scale to 50 on all MovieClips nested in the Array :
Parametersf:Function — function to run.
|
|
a:Array — array of parameters.
|
|
... args — args additionnal parameters to concat with the passed-in
arguments array
|
import com.bourre.commands.
function changeAlpha( mc : MovieClip, a : Number, s : Number )
{
mc._alpha = a;
mc._xscale = mc._yscale = s;
}
Batch.process( changeAlpha, [mc0, mc1, mc2], .4, 50 );
| removeAll | () | method |
public function removeAll():void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Removes all commands stored in the batch stack.
| removeCommand | () | method |
public function removeCommand(command:Command):Boolean
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Removes all references to the passed-in command.
If the command have been found and removed
from the Batch the function return
true.
command:Command — command object to be removed
|
Boolean — true if the command have been
successfully removed.
|
| setOwner | () | method |
public override function setOwner(owner:Plugin):void
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Defines the plugin owner of this command.
Generally the owner is defined by the
FrontController of a plugin when
it instantiate a command.
owner:Plugin — plugin which will own the command
|
| size | () | method |
public function size():uint
| Player version: | Flash Player 9.0 |
| Language version: | ActionScript 3.0 |
Returns the number of commands stored in this batch.
Returnsuint — the number of commands stored in this batch
|