チェンジセット 55
- コミット日時:
- 2007/09/03 14:02:14 (6 年前)
- ファイル:
-
- Mk-10/as2/src/jp/cellfusion/button/SimpleButton.as (更新) (3 diffs)
- Mk-10/as2/src/jp/cellfusion/commands/CommandBase.as (更新) (3 diffs)
- Mk-10/as2/src/jp/cellfusion/commands/EnterFrameCommand.as (更新) (1 diff)
- Mk-10/as2/src/jp/cellfusion/commands/MacroCommand.as (更新) (6 diffs)
- Mk-10/as2/src/jp/cellfusion/commands/SequenceCommand.as (更新) (6 diffs)
- Mk-10/as2/src/jp/cellfusion/commands/TweenCommand.as (追加)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
Mk-10/as2/src/jp/cellfusion/button/SimpleButton.as
r54 r55 21 21 public var content:MovieClip; 22 22 private var enabledMode:Boolean = true, actions:Object; 23 static public var ENABLE:String = " onEnable", DISABLE:String = "onDisable", ROLL_OVER:String = "onRollOver", ROLL_OUT:String = "onRollOut", PRESS:String = "onPress", RELEASE:String = "onRelease";23 static public var ENABLE:String = "enable", DISABLE:String = "disable", ROLL_OVER:String = "rollOver", ROLL_OUT:String = "rollOut", PRESS:String = "press", RELEASE:String = "release"; 24 24 private var _rollOverLabel:String = "over", _rollOutLabel:String = "normal", _pressLabel:String = "down", _releaseLabel:String = "normal", _enabledLabel:String = "normal", _disableLabel:String = "disable"; 25 25 … … 109 109 public function setAction(thisObj:Object, funcRef, args:Array, eventName:String):Void 110 110 { 111 if (eventName == null ) eventName = RELEASE;111 if (eventName == null || eventName == undefined) eventName = RELEASE; 112 112 actions[eventName] = {thisObj:thisObj, funcRef:funcRef, args:args}; 113 113 } … … 136 136 private function action(str:String):Void 137 137 { 138 if (actions[str] != undefined )138 if (actions[str] != undefined || actions[str] != null) 139 139 { 140 140 var thisObj:Object = actions[str].thisObj; Mk-10/as2/src/jp/cellfusion/commands/CommandBase.as
r54 r55 16 16 17 17 import mx.events.EventDispatcher; 18 19 import jp.cellfusion.events.CommandEvent;20 18 21 19 /** … … 45 43 private function getItemIndex(arr:Array, obj:Object):Number 46 44 { 47 for (var i=0; i<arr.length; i++) if (arr[i] == obj) return i;45 for (var i=0; i<arr.length; i++) if (arr[i] === obj) return i; 48 46 return - 1; 49 47 } … … 51 49 public function addEventListener(eventName:String, listener:Object):Void {} 52 50 public function removeEventListener(eventName:String, listener:Object):Void {} 53 private function dispatchEvent(event: CommandEvent):Void {}51 private function dispatchEvent(event:Object):Void {} 54 52 } Mk-10/as2/src/jp/cellfusion/commands/EnterFrameCommand.as
r54 r55 18 18 19 19 import jp.cellfusion.commands.CommandBase; 20 import jp.cellfusion.events.CommandEvent;21 20 22 21 /** Mk-10/as2/src/jp/cellfusion/commands/MacroCommand.as
r54 r55 15 15 */ 16 16 17 import mx.utils.Delegate; 18 17 19 import jp.cellfusion.commands.CommandBase; 18 20 19 21 class jp.cellfusion.commands.MacroCommand extends CommandBase { 20 private var _commands:Array ;22 private var _commands:Array, _cPH:Function, _cCH:Function, _endCommand:Number; 21 23 22 24 /** … … 25 27 */ 26 28 public function MacroCommand(commands:Array) { 29 _cPH = Delegate.create(this, this._commandProgressHandler); 30 _cCH = Delegate.create(this, this._commandCompleteHandler); 31 27 32 _commands = new Array(); 28 for (var i=0; i<commands.length; i++) { 29 var c = commands[i].clone(); 30 _commands.push(c); 33 // for (var i=0; i<commands.length; i++) { 34 // var c = commands[i].clone(); 35 // _commands.push(c); 36 // } 37 if (commands != undefined) 38 { 39 for (var i:Number = 0; i < commands.length; i++) { 40 var cmd:CommandBase = commands[i]; 41 add(cmd); 42 } 31 43 } 32 44 } … … 38 50 public function add(cmd:CommandBase):Boolean 39 51 { 52 if (cmd == null) return false; 40 53 var idx:Number = getItemIndex(_commands, cmd); 41 54 if (idx == -1) 42 55 { 43 56 _commands.push(cmd); 57 cmd.addEventListener(COMMAND_PROGRESS, _cPH); 58 cmd.addEventListener(COMMAND_COMPLETE, _cCH); 44 59 return true; 45 60 } … … 57 72 public function remove(cmd:CommandBase):Boolean 58 73 { 74 if (cmd == null) return false; 59 75 var idx:Number = getItemIndex(_commands, cmd); 60 76 if (idx != -1) 61 77 { 62 78 _commands.splice(idx, 1); 79 cmd.removeEventListener(COMMAND_PROGRESS, _cPH); 80 cmd.removeEventListener(COMMAND_COMPLETE, _cCH); 63 81 return true; 64 82 } … … 74 92 */ 75 93 public function execute():Boolean { 94 _endCommand = 0; 76 95 for (var i=0; i<_commands.length; i++) { 77 96 var rslt:Object = _commands[i].execute(); 78 97 79 dispatchEvent({type:COMMAND_PROGRESS, result:rslt});98 // dispatchEvent({type:COMMAND_PROGRESS, result:rslt}); 80 99 } 81 100 82 dispatchEvent({type:COMMAND_COMPLETE});101 // dispatchEvent({type:COMMAND_COMPLETE}); 83 102 return true; 84 103 } … … 91 110 } 92 111 112 private function _commandProgressHandler(eventObj:Object) { 113 // dispatchEvent({type:COMMAND_PROGRESS}); 114 dispatchEvent(eventObj); 115 } 116 117 private function _commandCompleteHandler(eventObj:Object) { 118 // trace("endCommand:"+_endCommand); 119 if (++_endCommand == _commands.length) 120 { 121 dispatchEvent({type:COMMAND_COMPLETE}); 122 } 123 } 124 93 125 function toString():String { 94 126 return "[type MacroCommand]"; Mk-10/as2/src/jp/cellfusion/commands/SequenceCommand.as
r54 r55 24 24 class jp.cellfusion.commands.SequenceCommand extends CommandBase { 25 25 26 private var _commands:Array; 27 private var _currentIndex:Number; 26 private var _commands:Array, _currentIndex:Number, _cPH:Function, _cCH:Function; 28 27 29 28 /** … … 32 31 */ 33 32 public function SequenceCommand(commands:Array) { 33 _cPH = Delegate.create(this, this._commandProgressHandler); 34 _cCH = Delegate.create(this, this._commandCompleteHandler); 35 34 36 _commands = new Array(); 35 37 _currentIndex = 0; … … 53 55 { 54 56 _commands.push(cmd); 55 cmd.addEventListener(COMMAND_PROGRESS, Delegate.create(this, this._commandProgressHandler));56 cmd.addEventListener(COMMAND_COMPLETE, Delegate.create(this, this._commandCompleteHandler));57 cmd.addEventListener(COMMAND_PROGRESS, _cPH); 58 cmd.addEventListener(COMMAND_COMPLETE, _cCH); 57 59 return true; 58 60 } … … 73 75 { 74 76 _commands.splice(idx, 1); 77 cmd.addEventListener(COMMAND_PROGRESS, _cPH); 78 cmd.addEventListener(COMMAND_COMPLETE, _cCH); 75 79 return true; 76 80 } … … 140 144 141 145 private function _executeNext() { 146 // trace("_executeNext currentIndex:"+_currentIndex); 142 147 var command = _commands[_currentIndex++]; 143 148 if (command) { … … 148 153 } 149 154 150 private function _commandProgressHandler(event:Object) { 151 dispatchEvent({type:COMMAND_PROGRESS, current:_currentIndex, length:_commands.length}); 155 private function _commandProgressHandler(eventObj:Object) { 156 // dispatchEvent({type:COMMAND_PROGRESS, current:_currentIndex, length:_commands.length}); 157 158 eventObj.current = _currentIndex; 159 eventObj.length = _commands.length; 160 dispatchEvent(eventObj); 152 161 } 153 162

