Packagecom.soma.core.interfaces
Interfacepublic interface ICommandASync extends ICommand, IResponder

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

Interface used to create asynchronous command.

View the examples

See also

com.soma.core.controller.Command
com.soma.core.interfaces.ICommand
com.soma.core.interfaces.IResponder


Public Methods
 MethodDefined By
 Inherited
execute(event:Event):void
Method called by the framework, this is the execution of the command.
ICommand
 Inherited
fault(info:Object):void
Method that receives a fault object.
IResponder
 Inherited
result(data:Object):void
Method that receives a success object.
IResponder
Examples
package {
    import flash.utils.clearTimeout;
    import flash.utils.setTimeout;
    import flash.events.Event;
    import com.soma.core.interfaces.ICommandASync;
    import com.soma.core.controller.Command;
    
    public class CommandASyncExample extends Command implements ICommandASync {
        private var _event:Event;
        private var _timer:int;
        public function CommandASyncExample() {
            
        }
        
        public function execute(event:Event):void {
            _event = event;
            _timer = setTimeout(result, 1000, {});
        }
        
        public function fault(info:Object):void {
            
        }
        
        public function result(data:Object):void {
            if (isPartOfASequence(_event)) {
                getSequencer(_event).executeNextCommand();
            }
            _event = null;
            clearTimeout(_timer);
        }
        
    }
}