Packagecom.bourre.commands
Classpublic class Batch
InheritanceBatch Inheritance AbstractCommand
ImplementsMacroCommand
SubclassesReversedBatch

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.



Protected Properties
 PropertyDefined by
  _aCommands : Array
Contains all commands currently in this macro command
Batch
 Inherited_owner : Plugin
A reference to the plugin owner of this command.
AbstractCommand
Public Methods
 MethodDefined by
  
Batch object don't accept any arguments in the constructor.
Batch
  
addCommand(command:Command):Boolean
Adds a command in the batch stack.
Batch
  
contains(command:Command):Boolean
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
 Inherited
Returns the exclusive logger object owned by the plugin.
AbstractCommand
 Inherited
getModel(key:String):AbstractModel
Returns a reference to the model AbstractModel.
AbstractCommand
 Inherited
Returns a reference to the owner of this command.
AbstractCommand
 Inherited
getView(key:String):AbstractView
Returns a reference to the view AbstractView.
AbstractCommand
 Inherited
isModelRegistered(key:String):Boolean
Check if a model AbstractModel is registered with passed key in owner's ModelLocator.
AbstractCommand
 Inherited
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
  
setOwner(owner:Plugin):void
Defines the plugin owner of this command.
Batch
  
size():uint
Returns the number of commands stored in this batch.
Batch
 Inherited
toString():String
Returns the string representation of this instance.
AbstractCommand
Protected Methods
 MethodDefined by
 Inherited
firePrivateEvent(e:Event):void
Fires a private event directly on this command's owner.
AbstractCommand
Property detail
_aCommandsproperty
protected var _aCommands:Array

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Contains all commands currently in this macro command

Constructor detail
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.

Method detail
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.

Parameters
command:Command — command a Command to add at the end of the current Batch

Returns
Booleantrue 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.

Parameters
command:Command — command object to look at

Returns
Booleantrue 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.

Parameters
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 :

Parameters
f:Function — function to run.
 
a:Array — array of parameters.
 
... args — args additionnal parameters to concat with the passed-in arguments array

Example
         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.

Parameters
command:Command — command object to be removed

Returns
Booleantrue 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.

Parameters
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.

Returns
uint — the number of commands stored in this batch