Packageorg.mymvc
Classpublic class MyMVCCommand
InheritanceMyMVCCommand Inheritance flash.events.EventDispatcher

This provides a common interface to all Command classes. All commands should follow the same pattern: pass an object (usually called input) as argment for execute(), do something, then emits a MyMVCEvent.COMPLETE event as output. If an error happened, output MyMVCEvent.ERROR. It may also emits progress event (MyMVCEvent.PROGRESS) during a lengthy process.

Note, Command should NOT dispatch event through evt.broadcast() or MyMVCRadioStation.dispatch(evt).



Public Properties
 PropertyDefined by
  internalData : *
Internal used by MyMVCC.
MyMVCCommand
  uniqueID : int
Internal used by MyMVCC.
MyMVCCommand
Public Methods
 MethodDefined by
  
Constructor
MyMVCCommand
  
execute(input:* = null):void
Execute the command.
MyMVCCommand
Protected Methods
 MethodDefined by
  
notifyComplete(data:Object = null):void
Notify listeners that the command has completed.
MyMVCCommand
  
notifyError(data:Object = null):void
Notify listeners that an error has occured executing the command.
MyMVCCommand
  
notifyProgress(data:Object = null):void
Notify listeners that the command has updated progress.
MyMVCCommand
Property detail
internalDataproperty
public var internalData:*

Internal used by MyMVCC. Developers don't have to care

uniqueIDproperty 
public var uniqueID:int

Internal used by MyMVCC. Developers don't have to care

Constructor detail
MyMVCCommand()constructor
public function MyMVCCommand()

Constructor

Method detail
execute()method
public function execute(input:* = null):void

Execute the command. Abstract method. Subclasses should override this function.

Parameters
input:* (default = null) — The input object. For example, if the class is to log in a user, the input object may be {user:{username:'jsmith', password:'abcd'}}. Input object should be included in the output through notifyComplete, notifyProgress, or notifyError.

You should avoid passing VO (value object) directly as argument.

notifyComplete()method 
protected function notifyComplete(data:Object = null):void

Notify listeners that the command has completed. Every command class should call notifyComplete after process completes.

Parameters
data:Object (default = null) — Data included in the event. In practice you should include the input and the output all together as data. For example, if the input is {user:{username:'jsmith', password:'abcd'}} and the class is to log in, then data can be {user:{username:'jsmith', password:'abcd'}, status:'success'}
notifyError()method 
protected function notifyError(data:Object = null):void

Notify listeners that an error has occured executing the command.

Parameters
data:Object (default = null) — Data included in the event. Date must have a property called 'message', which is a String indicating the error message. In practice, you should also include input content in data.
notifyProgress()method 
protected function notifyProgress(data:Object = null):void

Notify listeners that the command has updated progress.

Parameters
data:Object (default = null) — Data included in the event. Date must have a property called 'progress', which is int ranging from 0 to 100, indicating the percentage completed. In practice, you should also include input content in data. Note: The total is 100. Thus progress should be 0-100