Packagecom.soma.core.controller
Classpublic class ParallelCommand
InheritanceParallelCommand Inheritance Command Inheritance Object
Implements IParallelCommand

Author: Romuald Quantin - www.soundstep.com

Resources: http://www.soundstep.com/downloads/somacore

Actionscript version: 3.0

Copyright: Mozilla Public License 1.1 (MPL 1.1) http://www.opensource.org/licenses/mozilla1.1.php

The ParallelCommand class is used to execute a list of commands at the same time.

View the examples

See also

com.soma.core.controller.SomaController
com.soma.core.controller.Command
com.soma.core.controller.SequenceCommand
com.soma.core.interfaces.IParallelCommand


Public Properties
 PropertyDefined By
  commands : Array
[read-only] Retrieves the list of commands added as subcommands.
ParallelCommand
 Inheritedinjector : ISomaInjector
[read-only]
Command
 Inheritedinstance : ISoma
[read-only] Retrieves the instance of the framework.
Command
  length : int
[read-only] Retrieves the number of commands added as subcommands.
ParallelCommand
 Inheritedmediators : SomaMediators
[read-only]
Command
 Inheritedstage : Stage
[read-only] Get the stage that has been registered to the framework.
Command
Public Methods
 MethodDefined By
  
Create an instance of the ParallelCommand class.
ParallelCommand
 Inherited
addCommand(commandName:String, command:Class):void
Registers a command to the framework.
Command
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
Command
 Inherited
addModel(modelName:String, model:IModel):IModel
Registers a model to the framework.
Command
 Inherited
addView(viewName:String, view:Object):Object
Registers a view to the framework.
Command
 Inherited
addWire(wireName:String, wire:IWire):IWire
Registers a wire to the framework.
Command
 Inherited
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
Command
 Inherited
getCommand(commandName:String):Class
Retrieves the command class that has been registered with a command name.
Command
 Inherited
getCommands():Array
Retrieves all the command names (event type) that have been registered to the framework.
Command
 Inherited
Retrieves the last sequence command that has been instantiated in the framework.
Command
 Inherited
getModel(modelName:String):IModel
Retrieves the model instance that has been registered using its name.
Command
 Inherited
getModels():Dictionary
Retrieves all the model instances that have been registered to the framework.
Command
 Inherited
Retrieves all the sequence command instances that are running.
Command
 Inherited
Retrieves the sequence command instance using an event instance that has been created from this sequence command.
Command
 Inherited
getView(viewName:String):Object
Retrieves the view instance that has been registered using its name.
Command
 Inherited
getViews():Dictionary
Retrieves all the view instances that have been registered to the framework.
Command
 Inherited
getWire(wireName:String):IWire
Retrieves the wire instance that has been registered using its name.
Command
 Inherited
getWires():Dictionary
Retrieves all the wire instances that have been registered to the framework.
Command
 Inherited
hasCommand(commandName:String):Boolean
Indicates wether a command has been registered to the framework.
Command
 Inherited
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
Command
 Inherited
hasModel(modelName:String):Boolean
Indicates wether a model has been registered to the framework.
Command
 Inherited
hasView(viewName:String):Boolean
Indicates wether a view has been registered to the framework.
Command
 Inherited
hasWire(wireName:String):Boolean
Indicates wether a wire has been registered to the framework.
Command
 Inherited
isPartOfASequence(event:Event):Boolean
Indicates wether an event has been instantiated from a ISequenceCommand class.
Command
 Inherited
removeCommand(commandName:String):void
Removes a command from the framework.
Command
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
Command
 Inherited
removeModel(modelName:String):void
Removes a model from the framework and call the dispose method of this model.
Command
 Inherited
removeView(viewName:String):void
Removes a view from the framework and call the (optional) dispose method of this view.
Command
 Inherited
removeWire(wireName:String):void
Removes a wire from the framework and call the dispose method of this wire.
Command
 Inherited
Stops all the sequence command instances that are running.
Command
 Inherited
stopSequencer(sequencer:ISequenceCommand):Boolean
Stops a sequence command using the sequence command instance itself.
Command
 Inherited
stopSequencerWithEvent(event:Event):Boolean
Stops a sequence command using an event instance that has been created from this sequence command.
Command
 Inherited
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
Command
Protected Methods
 MethodDefined By
  
addSubCommand(event:Event):void
Add a command to the list of commands to execute in parallel.
ParallelCommand
 Inherited
initialize():void
Method that you can optionally overwrite and that is called after the command has been registered with the framework.
Command
  
Method that you can overwrite to add commands to the parallele command.
ParallelCommand
Property Detail
commandsproperty
commands:Array  [read-only]

Retrieves the list of commands added as subcommands.


Implementation
    public function get commands():Array
lengthproperty 
length:int  [read-only]

Retrieves the number of commands added as subcommands.


Implementation
    public function get length():int
Constructor Detail
ParallelCommand()Constructor
public function ParallelCommand()

Create an instance of the ParallelCommand class. Should not be directly instantiated, the framework will instantiate the class.

Method Detail
addSubCommand()method
protected final function addSubCommand(event:Event):void

Add a command to the list of commands to execute in parallel.

Parameters

event:Event — Event instance (must be registered as a command previously).

See also


Example
addSubCommand(new MyEvent(MyEvent.DO_SOMETHING));
initializeSubCommands()method 
protected function initializeSubCommands():void

Method that you can overwrite to add commands to the parallele command.

See also


Example
addSubCommand(new MyEvent(MyEvent.DO_SOMETHING));
Examples
Register commands and a parallel command.
addCommand(MyEvent.DO_SOMETHING, CommandExample);
addCommand(MyEvent.DO_SOMETHING_ELSE, CommandExample);
addCommand(MyEvent.EXECUTE_PARALLEL_COMMAND, ParallelCommandExample);
dispatchEvent(new MyEvent(MyEvent.EXECUTE_PARALLEL_COMMAND));
     
package  {
    import com.soma.core.interfaces.IParallelCommand;
    import com.soma.core.controller.ParallelCommand;
    
    public class ParallelCommandExample extends ParallelCommand implements IParallelCommand {
        public function ParallelCommandExample() {
            
        }
        
        override protected function initializeSubCommands():void {
            addSubCommand(new MyEvent(MyEvent.DO_SOMETHING));
            addSubCommand(new MyEvent(MyEvent.DO_SOMETHING_ELSE));
        }
        
    }
}