チェンジセット 2669
- コミット日時:
- 2009/05/19 00:35:56 (3 年前)
- ファイル:
-
- air/TLife/trunk/air/TLife.air (更新) (変更前)
- air/TLife/trunk/air/version.xml (更新) (1 diff)
- air/TLife/trunk/application.xml (更新) (1 diff)
- air/TLife/trunk/bin/TLife.swf (更新) (変更前)
- air/TLife/trunk/src/Main.mxml (更新) (3 diffs)
- air/TLife/trunk/src/uwi/db/DB.as (更新) (1 diff)
- air/TLife/trunk/src/uwi/search/Searcher.as (更新) (1 diff)
- air/TLife/trunk/src/uwi/thread/MainThread.as (更新) (1 diff)
- air/TLife/trunk/src/uwi/thread/NotifyNewThread.as (更新) (7 diffs)
- air/TLife/trunk/src/uwi/thread/event/ContextMenuItemEventThread.as (更新) (1 diff)
- air/TLife/trunk/src/uwi/thread/event/DataGridEventThread.as (更新) (5 diffs)
- air/TLife/trunk/src/uwi/thread/event/DataGridRoutineThread.as (更新) (1 diff)
- air/TLife/trunk/src/uwi/thread/event/IncrementalSearchThread.as (更新) (1 diff)
- air/TLife/trunk/src/uwi/thread/event/PostEventThread.as (更新) (8 diffs)
- air/TLife/trunk/src/uwi/thread/event/TabBarEventThread.as (更新) (5 diffs)
- air/TLife/trunk/src/uwi/ui/balloon/Balloon.mxml (更新) (4 diffs)
- air/TLife/trunk/src/uwi/ui/mainmenu/MainMenu.mxml (更新) (1 diff)
- air/TLife/trunk/src/uwi/ui/mainmenu/MainMenuEventThread.as (更新) (5 diffs)
- air/TLife/trunk/src/uwi/ui/multipletabbar/MultipleTabBar.as (更新) (3 diffs)
- air/TLife/trunk/src/uwi/ui/tabconfig/TabConfigEventThread.as (更新) (1 diff)
- air/TLife/trunk/src/uwi/util/CommonData.as (更新) (2 diffs)
- air/TLife/trunk/src/uwi/util/CompeteExecutor.as (追加)
- air/TLife/trunk/src/uwi/util/KeyBind.as (更新) (2 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
air/TLife/trunk/air/version.xml
r2653 r2669 1 1 <version> 2 <version>alpha2 2/version>2 <version>alpha23/version> 3 3 <url>http://www.libspark.org/svn/air/TLife/trunk/air/TLife.air</url> 4 4 </version> air/TLife/trunk/application.xml
r2653 r2669 3 3 4 4 <id>uwi.TLife</id> 5 <version>alpha2 2</version>5 <version>alpha23</version> 6 6 <filename>TLife</filename> 7 7 <name>TLife</name> air/TLife/trunk/src/Main.mxml
r2653 r2669 215 215 scrollposid : -1, 216 216 newestid : -1, 217 highlighted : 0, 217 218 numnotify : int(tab.@numnotify), 218 219 numdisplay : int(tab.@numdisplay), … … 296 297 "sameuserforwardatpostarea", "sameuserforwardattimeline" 297 298 ]; 298 CommonData.keybind judgers = { };299 CommonData.keybinds = { }; 299 300 for each(var keyword : String in keybindkeywords) { 300 CommonData.keybind judgers[keyword] = KeyBind.makeJudger(CommonData.configxml.keybind.child(keyword));301 CommonData.keybinds[keyword] = KeyBind.makeJudger(CommonData.configxml.keybind.child(keyword)); 301 302 } 302 303 } … … 465 466 headerStyleName="timelineheaderstyle" 466 467 verticalScrollBarStyleName="timelinescrollbarstyle" 468 dragEnabled="true" 467 469 > 468 470 <!-- air/TLife/trunk/src/uwi/db/DB.as
r2634 r2669 67 67 } 68 68 69 public function dropTables() : void 70 { 71 execute(conn, "drop table if exists " + CommonData.TABLE_STATUS); 72 execute(conn, "drop table if exists " + CommonData.TABLE_POSTER); 73 execute(conn, "drop table if exists " + CommonData.TABLE_FOLLOWING); 74 } 75 69 76 public static function execute(conn : SQLConnection, text : String) : void 70 77 { air/TLife/trunk/src/uwi/search/Searcher.as
r2653 r2669 183 183 rule : conds.join(" and "), 184 184 type : 1, 185 highlighted : 0, 185 186 numdisplay : 999, 186 187 numnotify : 0, air/TLife/trunk/src/uwi/thread/MainThread.as
r2651 r2669 137 137 new PostEventThread().start(); 138 138 new UndoThread(Application.application.postarea, Application.application.changeCharLeft).start(); 139 new MultipleTabBarDragEventThread(Application.application.tabbar).start(); 139 140 new DataGridEventThread().start(); 140 141 new DataGridRoutineThread().start(); air/TLife/trunk/src/uwi/thread/NotifyNewThread.as
r2651 r2669 5 5 import flash.events.Event; 6 6 import ken39arg.logging.Logger; 7 import mx.controls.Button; 7 8 import mx.core.Application; 8 9 import org.libspark.thread.Thread; … … 48 49 for each(var tabname : String in tabbar.titles) { 49 50 var numnotify : int = Utility.getNumber("numnotify", tabname); 50 // var manageunread : int = Utility.getNumber("manageunread", tabname); 51 // if (numnotify > 0 || manageunread == 1) { 52 if (numnotify > 0) { // 未読管理時のタブ強調の扱い 51 if (numnotify > 0) { 53 52 var sqlsuffix : String = " order by postid desc limit " + numnotify; 54 53 var sql : String = null; … … 107 106 var ret : SQLResult = dbst.Result; 108 107 var ar : Array = ret.data; 109 if (ar != null ) {108 if (ar != null && ar.length > 0) { 110 109 for each(var obj : * in ar) { 111 110 posteridset2[obj.posterid] = null; … … 113 112 114 113 // newestidの更新 115 if (ar.length > 0) { 116 var newest : Number = ar[0].postid; 117 if (CommonData.tabmap[tabname].newestid < newest) { 118 CommonData.tabmap[tabname].newestid = newest; 119 } 114 var newest : Number = ar[0].postid; 115 if (CommonData.tabmap[tabname].newestid < newest) { 116 CommonData.tabmap[tabname].newestid = newest; 117 } 118 119 // 選択されていない新着タブを強調表示 120 if (tabname != Application.application.tabbar.selectedTabName) { 121 CommonData.tabmap[tabname].highlighted = 1; 120 122 } 121 123 … … 124 126 } 125 127 128 tabbar.dispatchEvent(new Event("change_layout")); 129 126 130 dbstmap2 = { }; 127 131 pe = new ParallelExecutor(); … … 184 188 for (i = 0; i < tl.length; i++) { 185 189 status = tl[i]; 190 // Balloonの発言 186 191 // TODO Formatterをつくる 187 192 text += status.postername; … … 193 198 b.baseY = getHighestBalloonY(); 194 199 195 var f : Function = function(e : Event) : void { 196 b.removeEventListener(Event.CLOSING, f); 200 var f : Function = function(b_ : Balloon) : void { 197 201 delete CommonData.balloons[b]; 198 202 }; 199 b. addEventListener(Event.CLOSING, f);203 b.closeHandler = f; 200 204 b.timeout = int(CommonData.configxml.balloon.timeout); 201 205 b.open(false); air/TLife/trunk/src/uwi/thread/event/ContextMenuItemEventThread.as
r2652 r2669 387 387 newestid : -1, 388 388 rule : "", 389 highlighted : 0, 389 390 numnotify : -1, 390 391 manageunread : -1, air/TLife/trunk/src/uwi/thread/event/DataGridEventThread.as
r2651 r2669 15 15 import uwi.util.CommonData; 16 16 import uwi.util.EventThread; 17 import uwi.util.KeyBind; 17 18 import uwi.util.Utility; 18 19 … … 89 90 90 91 /** 91 * up/down : select next/previous status. (default)92 * left/right : select next/previous same poster's status.93 92 * @param e 94 93 */ … … 97 96 if (datagrid.selectedIndex == -1) datagrid.selectedIndex = 0; 98 97 99 if (CommonData.keybindjudgers.jumptopostarea.apply(null, [e])) { 98 var code : int = KeyBind.encode(e); 99 if (CommonData.keybinds.jumptopostarea == code) { 100 100 Application.application.postarea.setFocus(); 101 101 next(waitEvents); … … 103 103 } 104 104 105 if(CommonData.keybind judgers.replyattimeline.apply(null, [e])){105 if(CommonData.keybinds.replyattimeline == code){ 106 106 CommonData.in_reply_to_status_id = ""; 107 107 Application.application.appendReply(datagrid.selectedItem); 108 108 } 109 109 110 if (CommonData.keybind judgers.sameuserforwardattimeline.apply(null, [e])) {110 if (CommonData.keybinds.sameuserforwardattimeline == code) { 111 111 datagrid.selectedIndex = Utility.searchSamePoster(timeline, datagrid.selectedIndex, 1); 112 112 datagrid.scrollToIndex(datagrid.selectedIndex); … … 114 114 } 115 115 116 if (CommonData.keybind judgers.sameuserbackwardattimeline.apply(null, [e])) {116 if (CommonData.keybinds.sameuserbackwardattimeline == code) { 117 117 datagrid.selectedIndex = Utility.searchSamePoster(timeline, datagrid.selectedIndex, -1); 118 118 datagrid.scrollToIndex(datagrid.selectedIndex); air/TLife/trunk/src/uwi/thread/event/DataGridRoutineThread.as
r2650 r2669 90 90 var len : int = timeline.length - datagrid.maxVerticalScrollPosition + 1; 91 91 var sup : int = Math.min(timeline.length, datagrid.verticalScrollPosition + len); 92 for (var i : int = datagrid.verticalScrollPosition; i < sup; i++) {92 for (var i : uint = datagrid.verticalScrollPosition; i < sup; i++) { 93 93 var posterid : String = timeline[i].posterid; 94 for (var j : int = 0; j < datagrid.columnCount;j++){94 for (var j : uint = 0; j < datagrid.columnCount;j++){ 95 95 var ir : DataGridItemRenderer = datagrid.rowcolToItemRenderer(i, j) as DataGridItemRenderer; 96 96 if (ir == null) continue; air/TLife/trunk/src/uwi/thread/event/IncrementalSearchThread.as
r2642 r2669 80 80 switch(mode) { 81 81 case 0: 82 var code : int = KeyBind.encode(e); 82 83 for (var i : int = 1; i <= 4; i++) { 83 if (CommonData.keybind judgers[KEYWORDS[i]].apply(null, [e])) {84 if (CommonData.keybinds[KEYWORDS[i]] == code) { 84 85 mode = i; 85 86 CommonData.mainstatusbar.write(STR_SEARCH[mode], DEPTH_IST); air/TLife/trunk/src/uwi/thread/event/PostEventThread.as
r2653 r2669 25 25 import uwi.util.CommonData; 26 26 import uwi.util.EventThread; 27 import uwi.util.KeyBind; 27 28 import uwi.util.OAuthUtility; 28 29 import uwi.util.Utility; … … 81 82 // e.stopPropagation(); 82 83 83 // \rが文字数にカウントされない現象の改善 84 // \rが文字数にカウントされない現象の改善(1行目の改行には反映されていない様子) 84 85 if (e.keyCode == Keyboard.ENTER && (e.controlKey == true || e.altKey == true)) { 85 86 e.preventDefault(); 86 87 postarea.TextField.replaceSelectedText("\n"); 88 trace("にゃー"); 87 89 postarea.TextField.dispatchEvent(EVENT_CHANGE); 88 90 } … … 99 101 } 100 102 101 if (CommonData.keybindjudgers.jumptotimeline.apply(null, [e])) { 103 var code : int = KeyBind.encode(e); 104 105 if (CommonData.keybinds.jumptotimeline == code) { 102 106 Application.application.datagrid.setFocus(); 103 107 next(waitEvents); … … 105 109 } 106 110 107 if(CommonData.keybind judgers.replyatpostarea.apply(null, [e])){111 if(CommonData.keybinds.replyatpostarea == code){ 108 112 CommonData.in_reply_to_status_id = ""; 109 113 Application.application.appendReply(datagrid.selectedItem); … … 112 116 } 113 117 114 if (CommonData.keybind judgers.downatpostarea.apply(null, [e])) {118 if (CommonData.keybinds.downatpostarea == code) { 115 119 if (datagrid.selectedIndex == -1) datagrid.selectedIndex = datagrid.verticalScrollPosition; 116 120 datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_DOWN, true, false, 0, Keyboard.DOWN)); … … 118 122 } 119 123 120 if (CommonData.keybind judgers.upatpostarea.apply(null, [e])) {124 if (CommonData.keybinds.upatpostarea == code) { 121 125 if (datagrid.selectedIndex == -1) datagrid.selectedIndex = datagrid.verticalScrollPosition; 122 126 datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_DOWN, true, false, 0, Keyboard.UP)); … … 124 128 } 125 129 126 if (CommonData.keybind judgers.sameuserforwardatpostarea.apply(null, [e])) {130 if (CommonData.keybinds.sameuserforwardatpostarea == code) { 127 131 datagrid.selectedIndex = Utility.searchSamePoster(Application.application.timeline, datagrid.selectedIndex, 1); 128 132 datagrid.scrollToIndex(datagrid.selectedIndex); … … 130 134 } 131 135 132 if (CommonData.keybind judgers.sameuserbackwardatpostarea.apply(null, [e])) {136 if (CommonData.keybinds.sameuserbackwardatpostarea == code) { 133 137 datagrid.selectedIndex = Utility.searchSamePoster(Application.application.timeline, datagrid.selectedIndex, -1); 134 138 datagrid.scrollToIndex(datagrid.selectedIndex); air/TLife/trunk/src/uwi/thread/event/TabBarEventThread.as
r2634 r2669 2 2 { 3 3 import flash.events.Event; 4 import mx.collections.ArrayCollection; 5 import mx.controls.Button; 4 6 import mx.core.Application; 7 import mx.events.DragEvent; 5 8 import mx.events.ItemClickEvent; 6 9 import org.libspark.thread.Thread; … … 18 21 { 19 22 private var sub : EventThread; 23 private var sub2 : EventThread; 20 24 21 25 public function TabBarEventThread() … … 34 38 sub = new EventThread(mtb, Event.CHANGE, onChange); 35 39 sub.start(); 40 sub2 = new EventThread(mtb, "change_layout", onChangeLayout); 41 sub2.start(); 36 42 37 43 super.run(); … … 40 46 private function onChange(e : Event) : void 41 47 { 48 CommonData.tabmap[mtb.selectedTabName].highlighted = false; 49 42 50 var ttt : TimelineThread = new TimelineThread(); 43 51 ttt.start(); … … 52 60 super.onItemClick(e); 53 61 } 62 63 // スタイルの変更 64 private function onChangeLayout(e : Event) : void 65 { 66 var len : int = mtb.titles.length; 67 for (var i : int = 0; i < len; i++) { 68 var title : String = mtb.titles.getItemAt(i) as String; 69 var btn : Button = mtb.getTab(i); 70 btn.setStyle("fontWeight", CommonData.tabmap[title].highlighted ? "bold" : "normal"); 71 } 72 next(sub2.waitEvents); 73 } 54 74 } 55 75 air/TLife/trunk/src/uwi/ui/balloon/Balloon.mxml
r2634 r2669 17 17 resizable="false" 18 18 creationComplete="onLoad()" 19 showStatusBar="false"20 showTitleBar="false"19 showStatusBar="false" 20 showTitleBar="false" 21 21 showFlexChrome="false" 22 alwaysInFront="true" 22 23 > 23 24 … … 40 41 public var timeout : int; 41 42 public var baseY : Number; 43 public var closeHandler : Function = null; 42 44 43 45 private var tfcontent : TextField; … … 65 67 stage.nativeWindow.width = MAXWIDTH; 66 68 stage.nativeWindow.height = MAXHEIGHT; 67 68 this.alwaysInFront = true;69 69 } 70 70 … … 74 74 timer.stop(); 75 75 timer = null; 76 if (closeHandler != null) closeHandler.apply(null, [this]); 76 77 this.close(); 77 78 } air/TLife/trunk/src/uwi/ui/mainmenu/MainMenu.mxml
r2651 r2669 10 10 remove="onRemove()" 11 11 > 12 <mx:Button id="dbsearch" label="DB検索" width="100%" /> 13 <mx:Button id="relogin" label="再ログイン" width="100%" /> 14 <mx:Button id="oauth" label="OAuth認証" width="100%" /> 15 <mx:Button id="config" label="設定" width="100%" /> 16 <mx:Button id="checkupdate" label="更新チェック" width="100%" /> 17 <mx:Button id="about" label="About" width="100%" click="PopUpManager.removePopUp(this)" /> 12 13 <mx:HBox> 14 <mx:VBox> 15 <mx:Button id="dbsearch" label="DB検索" width="100%" /> 16 <mx:Button id="relogin" label="再ログイン" width="100%" /> 17 <mx:Button id="oauth" label="OAuth認証" width="100%" /> 18 <mx:Button id="config" label="設定" width="100%" /> 19 </mx:VBox> 20 <mx:VBox> 21 <mx:Button id="checkupdate" label="更新チェック" width="100%" /> 22 <mx:Button id="cleardbmemory" label="オンメモリDBクリア" width="100%" /> 23 <mx:Button id="about" label="About" width="100%" click="PopUpManager.removePopUp(this)" /> 24 </mx:VBox> 25 </mx:HBox> 18 26 <mx:Label id="version" textAlign="right" width="100%" /> 19 27 air/TLife/trunk/src/uwi/ui/mainmenu/MainMenuEventThread.as
r2642 r2669 6 6 import net.jirox.AirAutoUpdater; 7 7 import org.libspark.thread.Thread; 8 import uwi.db.DBExcite; 8 9 import uwi.thread.InitialMovementThread; 9 10 import uwi.twitter.TwitterOAuthRequestThread; … … 32 33 event(mainmenu.oauth, MouseEvent.CLICK, onOAuthClick); 33 34 event(mainmenu.checkupdate, MouseEvent.CLICK, onCheckUpdateClick); 35 event(mainmenu.cleardbmemory, MouseEvent.CLICK, onClearDBMemoryClick); 34 36 } 35 37 … … 55 57 CommonData.globalconfig.orderToFront(); 56 58 } 57 next(run);58 59 } 59 60 … … 70 71 } 71 72 72 private function onCheckUpdateClick( ) : void73 private function onCheckUpdateClick(e : MouseEvent) : void 73 74 { 74 75 PopUpManager.removePopUp(mainmenu); … … 77 78 aau.checkUpdate(); 78 79 } 80 81 private function onClearDBMemoryClick(e : MouseEvent) : void 82 { 83 PopUpManager.removePopUp(mainmenu); 84 CommonData.db_memory.dropTables(); 85 CommonData.db_memory.createTables(); 86 DBExcite.excite(true); 87 } 79 88 } 80 89 air/TLife/trunk/src/uwi/ui/multipletabbar/MultipleTabBar.as
r2652 r2669 19 19 public var tabheight : Number; 20 20 private static const EVENT_CHANGE : Event = new Event(Event.CHANGE); 21 private static const EVENT_CHANGELAYOUT : Event = new Event("change_layout"); 21 22 22 23 public function MultipleTabBar(tabheight : Number = 20) { … … 75 76 var ind : int = index != -1 ? index : selectedIndex; 76 77 this.callLater(function() : void { 78 setSelectedIndexCore(ind); 77 79 if (ind != selectedIndex) { 78 80 dispatchEvent(EVENT_CHANGE); 79 81 } 80 setSelectedIndexCore(ind);82 dispatchEvent(EVENT_CHANGELAYOUT); 81 83 }); 82 84 } … … 95 97 selectedIndex = sum + e.index; 96 98 dispatchEvent(EVENT_CHANGE); 99 dispatchEvent(EVENT_CHANGELAYOUT); 97 100 for each(var tab : TabBar in tablist) { 98 101 if (tab != targ) tab.selectedIndex = -1; air/TLife/trunk/src/uwi/ui/tabconfig/TabConfigEventThread.as
r2650 r2669 126 126 newestid : -1, 127 127 rule : "", 128 highlighted : 0, 128 129 numnotify : -1, 129 130 manageunread : -1, air/TLife/trunk/src/uwi/util/CommonData.as
r2653 r2669 101 101 public static var prevpos_replypost : int = -1; 102 102 103 public static var keybind judgers : Object;103 public static var keybinds : Object; 104 104 105 105 public static var urlcache : Object = { }; // URL解決用のキャッシュ … … 117 117 // type : int タブの種類 (0 : 通常のタブ, 1 : 検索結果タブ) 118 118 // cache : Object 検索結果のキャッシュ 119 // highlighted : 強調するかどうか(0, 1) 119 120 // --------以下はconfigxmlに格納-------- 120 121 // numnotify : int 新着通知件数 (0 : 新着通知しない, 負 : グローバル設定に従う) air/TLife/trunk/src/uwi/util/KeyBind.as
r2642 r2669 10 10 public class KeyBind 11 11 { 12 private static const FUNCTION_FAILED : Function = function(e : KeyboardEvent) : Boolean { return false; }; 12 public static function encode(e : KeyboardEvent) : int 13 { 14 return e.keyCode | (e.controlKey ? 512 : 0) | (e.altKey ? 1024 : 0) | (e.shiftKey ? 2048 : 0); 15 } 13 16 14 private static const KEYMAP : Object = { 15 down : Keyboard.DOWN, 16 up : Keyboard.UP, 17 left : Keyboard.LEFT, 18 right : Keyboard.RIGHT, 19 enter : Keyboard.ENTER, 20 nenter : Keyboard.NUMPAD_ENTER, 21 space : Keyboard.SPACE, 22 backspace : Keyboard.BACKSPACE, 23 f1 : Keyboard.F1, 24 f2 : Keyboard.F2, 25 f3 : Keyboard.F3, 26 f4 : Keyboard.F4, 27 f5 : Keyboard.F5, 28 f6 : Keyboard.F6, 29 f7 : Keyboard.F7, 30 f8 : Keyboard.F8, 31 f9 : Keyboard.F9, 32 f10 : Keyboard.F10, 33 f11 : Keyboard.F11, 34 f12 : Keyboard.F12, 35 escape : Keyboard.ESCAPE, 36 capslock : Keyboard.CAPS_LOCK, 37 home : Keyboard.HOME, 38 end : Keyboard.END, 39 a : Keyboard.A, 40 b : Keyboard.B, 41 c : Keyboard.C, 42 d : Keyboard.D, 43 e : Keyboard.E, 44 f : Keyboard.F, 45 g : Keyboard.G, 46 h : Keyboard.H, 47 i : Keyboard.I, 48 j : Keyboard.J, 49 k : Keyboard.K, 50 l : Keyboard.L, 51 m : Keyboard.M, 52 n : Keyboard.N, 53 o : Keyboard.O, 54 p : Keyboard.P, 55 q : Keyboard.Q, 56 r : Keyboard.R, 57 s : Keyboard.S, 58 t : Keyboard.T, 59 u : Keyboard.U, 60 v : Keyboard.V, 61 w : Keyboard.W, 62 x : Keyboard.X, 63 y : Keyboard.Y, 64 z : Keyboard.Z 65 }; 66 67 /** 68 * キーバインド判定関数を作成する。失敗した場合常にfalseを返す判定関数を作成する。 69 * @param src 70 * @return 71 */ 72 public static function makeJudger(src : String) : Function 17 public static function makeJudger(src : String) : int 73 18 { 74 19 src = src.toLowerCase(); 75 20 76 21 var keys : Array = src.split("+"); 77 if (keys.length == 0) return FUNCTION_FAILED;22 if (keys.length == 0) return 0; 78 23 var last : String = keys.pop(); 79 24 var ctrl : Boolean = keys.indexOf("ctrl") != -1; … … 81 26 var shift : Boolean = keys.indexOf("shift") != -1; 82 27 83 var keycode : uint; 84 if (KEYMAP[last]) { 85 keycode = KEYMAP[last]; 86 }else{ 87 switch(last) { 88 case "-" : keycode = Keyboard.MINUS; break; 89 case "n+" : keycode = Keyboard.NUMPAD_ADD; break; 90 case "n-" : keycode = Keyboard.NUMPAD_SUBTRACT; break; 91 case "n*" : keycode = Keyboard.NUMPAD_MULTIPLY; break; 92 case "n/" : keycode = Keyboard.NUMPAD_DIVIDE; break; 93 case "n." : keycode = Keyboard.NUMPAD_DECIMAL; break; 94 case "." : keycode = Keyboard.PERIOD; break; 95 case "," : keycode = Keyboard.COMMA; break; 96 case "'" : keycode = Keyboard.QUOTE; break; 97 case "\\" : keycode = Keyboard.BACKSLASH; break; 98 case "/" : keycode = Keyboard.SLASH; break; 99 case "`" : keycode = Keyboard.BACKQUOTE; break; 100 case ";" : keycode = Keyboard.SEMICOLON; break; 101 case "=" : keycode = Keyboard.EQUAL; break; 102 case "[" : keycode = Keyboard.LEFTBRACKET; break; 103 case "]" : keycode = Keyboard.RIGHTBRACKET; break; 104 case "0" : keycode = Keyboard.NUMBER_0; break; 105 case "1" : keycode = Keyboard.NUMBER_1; break; 106 case "2" : keycode = Keyboard.NUMBER_2; break; 107 case "3" : keycode = Keyboard.NUMBER_3; break; 108 case "4" : keycode = Keyboard.NUMBER_4; break; 109 case "5" : keycode = Keyboard.NUMBER_5; break; 110 case "6" : keycode = Keyboard.NUMBER_6; break; 111 case "7" : keycode = Keyboard.NUMBER_7; break; 112 case "8" : keycode = Keyboard.NUMBER_8; break; 113 case "9" : keycode = Keyboard.NUMBER_9; break; 114 default : 115 return FUNCTION_FAILED; 116 break; 117 } 28 var keycode : uint = 0; 29 switch(last) { 30 case "down" : keycode = Keyboard.DOWN; break; 31 case "up" : keycode = Keyboard.UP; break; 32 case "left" : keycode = Keyboard.LEFT; break; 33 case "right" : keycode = Keyboard.RIGHT; break; 34 case "enter" : keycode = Keyboard.ENTER; break; 35 case "nenter" : keycode = Keyboard.NUMPAD_ENTER; break; 36 case "space" : keycode = Keyboard.SPACE; break; 37 case "backspace" : keycode = Keyboard.BACKSPACE; break; 38 case "f1" : keycode = Keyboard.F1; break; 39 case "f2" : keycode = Keyboard.F2; break; 40 case "f3" : keycode = Keyboard.F3; break; 41 case "f4" : keycode = Keyboard.F4; break; 42 case "f5" : keycode = Keyboard.F5; break; 43 case "f6" : keycode = Keyboard.F6; break; 44 case "f7" : keycode = Keyboard.F7; break; 45 case "f8" : keycode = Keyboard.F8; break; 46 case "f9" : keycode = Keyboard.F9; break; 47 case "f10" : keycode = Keyboard.F10; break; 48 case "f11" : keycode = Keyboard.F11; break; 49 case "f12" : keycode = Keyboard.F12; break; 50 case "escape" : keycode = Keyboard.ESCAPE; break; 51 case "capslock" : keycode = Keyboard.CAPS_LOCK; break; 52 case "home" : keycode = Keyboard.HOME; break; 53 case "end" : keycode = Keyboard.END; break; 54 case "-" : keycode = Keyboard.MINUS; break; 55 case "n+" : keycode = Keyboard.NUMPAD_ADD; break; 56 case "n-" : keycode = Keyboard.NUMPAD_SUBTRACT; break; 57 case "n*" : keycode = Keyboard.NUMPAD_MULTIPLY; break; 58 case "n/" : keycode = Keyboard.NUMPAD_DIVIDE; break; 59 case "n." : keycode = Keyboard.NUMPAD_DECIMAL; break; 60 case "." : keycode = Keyboard.PERIOD; break; 61 case "," : keycode = Keyboard.COMMA; break; 62 case "'" : keycode = Keyboard.QUOTE; break; 63 case "\\" : keycode = Keyboard.BACKSLASH; break; 64 case "/" : keycode = Keyboard.SLASH; break; 65 case "`" : keycode = Keyboard.BACKQUOTE; break; 66 case ";" : keycode = Keyboard.SEMICOLON; break; 67 case "=" : keycode = Keyboard.EQUAL; break; 68 case "[" : keycode = Keyboard.LEFTBRACKET; break; 69 case "]" : keycode = Keyboard.RIGHTBRACKET; break; 70 default : 71 if(last.length == 1){ 72 var c : int = last.charCodeAt(0); 73 if (c >= "a".charCodeAt(0) && c <= "z".charCodeAt(0)) { 74 keycode = Keyboard.A + (c - "a".charCodeAt(0)); 75 } 76 if (c >= "0".charCodeAt(0) && c <= "9".charCodeAt(0)) { 77 keycode = Keyboard.NUMBER_0 + int(last); 78 } 79 } 80 break; 118 81 } 119 120 return function(e : KeyboardEvent) : Boolean { 121 return e.controlKey == ctrl && e.altKey == alt && e.shiftKey == shift && e.keyCode == keycode; 122 }; 82 return keycode | (ctrl ? 512 : 0) | (alt ? 1024 : 0) | (shift ? 2048 : 0); 123 83 } 124 84 } 125 126 85 }

