チェンジセット 203
- コミット日時:
- 2008/01/17 12:52:29 (4 年前)
- ファイル:
-
- as3/Commands/src/Command.as (更新) (3 diffs)
- as3/Commands/src/CommandBase.as (更新) (1 diff)
- as3/Commands/src/ICommand.as (追加)
- as3/Commands/src/ParallelCommand.as (更新) (2 diffs)
- as3/Commands/src/SerialCommand.as (更新) (3 diffs)
- as3/Commands/src/WaitCommand.as (更新) (3 diffs)
- as3/Commands/src/ext/LoaderCommand.as (追加)
- as3/Commands/src/ext/TweenerCommand.as (追加)
- as3/Commands/src/ext/URLLoaderCommand.as (追加)
- as3/Commands/src/ext/XMLLoaderCommand.as (追加)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/Commands/src/Command.as
r47 r203 2 2 { 3 3 /** 4 * execute時に特定の関数を実行するコマンド 4 * Executes passed function, when execute() is called. 5 * After execution, this dispaches Event.COMPLETE. 5 6 * 6 7 * @usage … … 16 17 protected var _params : Array; 17 18 18 public function Command(thisObject:Object, func:Function, params:Array) 19 /** 20 * @param thisObject:Object Scope that is used as "this" 21 * @param func:Function Function will be executed 22 * @param params:Array Parameters will be passed to function 23 */ 24 public function Command(thisObject:Object, func:Function, params:Array=null) 19 25 { 20 26 super(); … … 26 32 override public function execute():void 27 33 { 28 _function.apply(_thisObject, _params); 34 if(_params==null){ 35 _function.apply(_thisObject); 36 }else{ 37 _function.apply(_thisObject, _params); 38 } 39 29 40 this.dispatchComplete(); 30 41 } as3/Commands/src/CommandBase.as
r200 r203 5 5 6 6 /** 7 * 全てのコマンドのベースクラス7 * Abstract class for all commands package. 8 8 */ 9 public class CommandBase extends EventDispatcher 9 public class CommandBase extends EventDispatcher implements ICommand 10 10 { 11 //ここをオーバーライドして処理を実装する。 11 /** 12 * Template function. 13 * 14 * Simply override this function with your own processing, after call dispatchComplete() function. 15 */ 12 16 public function execute():void{} 13 17 14 //コマンドをキャンセルする。 18 19 //cancel commands 15 20 public function cancel():void{} 16 21 17 //コマンド終了時のイベント発行。 18 //execute以降の全ての処理が終わったら、コイツを呼び出す。 22 23 /** 24 * dispatches event after command completation. 25 */ 19 26 protected function dispatchComplete():void 20 27 { 21 dispatchEvent( new Event(Event.COMPLETE) );28 dispatchEvent( new Event(Event.COMPLETE) ); 22 29 } 23 30 } as3/Commands/src/ParallelCommand.as
r47 r203 30 30 31 31 32 public function push(com:ICommand):void 33 { 34 _commands.push(com); 35 } 36 37 32 38 override public function execute():void 33 39 { 34 40 for(var i:int = 0; i<_commands.length; i++) 35 41 { 36 var c : CommandBase= _commands[ i ];42 var c : ICommand = _commands[ i ]; 37 43 c.addEventListener(Event.COMPLETE, doNextCompleteHandler); 38 44 c.execute(); … … 43 49 protected function doNextCompleteHandler( e:Event ):void 44 50 { 45 var c : CommandBase = e.target as CommandBase;51 var c : ICommand = ICommand(e.target); 46 52 c.removeEventListener(Event.COMPLETE, doNextCompleteHandler); 47 53 _index ++; as3/Commands/src/SerialCommand.as
r200 r203 30 30 } 31 31 32 public function push(com: CommandBase):void32 public function push(com:ICommand):void 33 33 { 34 34 _commands.push(com); … … 44 44 protected function doNext():void 45 45 { 46 var c : CommandBase= _commands[ _index ];46 var c :ICommand = _commands[ _index ]; 47 47 c.addEventListener(Event.COMPLETE, doNextCompleteHandler); 48 48 c.execute(); … … 52 52 protected function doNextCompleteHandler( e:Event ):void 53 53 { 54 var c : CommandBase = e.target as CommandBase;54 var c :ICommand = ICommand(e.target); 55 55 c.removeEventListener(Event.COMPLETE, doNextCompleteHandler); 56 56 as3/Commands/src/WaitCommand.as
r47 r203 5 5 6 6 /** 7 * 一定時間待つコマンド。SerialCommand等で待ちを入れたいときに使う。 7 * Dispatches Event.COMPLETE event after certain delay. 8 * Used for taking a break between multiple commands. 8 9 * 9 10 * @usage 10 * 11 * var wc : WaitCommand = new WaitCommand(1000); 12 * wc.execute(); 13 * 11 * var command : WaitCommand = new WaitCommand(1000); 12 * command.execute(); 14 13 */ 15 14 public class WaitCommand extends CommandBase … … 18 17 protected var _delay:Number 19 18 19 /** 20 * dispatches Event.COMPLETE event after certain delay. 21 * @param millisecond duration for delay 22 */ 20 23 public function WaitCommand( delay:Number = 1000) 21 24 { … … 36 39 { 37 40 _timer.removeEventListener(TimerEvent.TIMER_COMPLETE, executeCompleteHandler ); 41 _timer = null; 38 42 dispatchComplete(); 39 43 }

