Package | com.soma.core.interfaces |
Interface | public 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.See also
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); } } }