チェンジセット 2669

差分発生行の前後
無視リスト:
コミット日時:
2009/05/19 00:35:56 (3 年前)
コミッタ:
uwi
ログメッセージ:

未読タブ
キーバインド
他諸々

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • air/TLife/trunk/air/version.xml

    r2653 r2669  
    11<version> 
    2         <version>alpha22/version> 
     2        <version>alpha23/version> 
    33        <url>http://www.libspark.org/svn/air/TLife/trunk/air/TLife.air</url> 
    44</version>  
  • air/TLife/trunk/application.xml

    r2653 r2669  
    33   
    44  <id>uwi.TLife</id>  
    5   <version>alpha22</version> 
     5  <version>alpha23</version> 
    66  <filename>TLife</filename> 
    77  <name>TLife</name>  
  • air/TLife/trunk/src/Main.mxml

    r2653 r2669  
    215215                                                scrollposid : -1, 
    216216                                                newestid : -1,  
     217            highlighted : 0, 
    217218                                                numnotify : int(tab.@numnotify), 
    218219                                                numdisplay : int(tab.@numdisplay), 
     
    296297          "sameuserforwardatpostarea", "sameuserforwardattimeline" 
    297298          ]; 
    298         CommonData.keybindjudgers = { }; 
     299        CommonData.keybinds = { }; 
    299300        for each(var keyword : String in keybindkeywords) { 
    300           CommonData.keybindjudgers[keyword] = KeyBind.makeJudger(CommonData.configxml.keybind.child(keyword)); 
     301          CommonData.keybinds[keyword] = KeyBind.makeJudger(CommonData.configxml.keybind.child(keyword)); 
    301302        } 
    302303                        } 
     
    465466                                        headerStyleName="timelineheaderstyle" 
    466467                                        verticalScrollBarStyleName="timelinescrollbarstyle" 
     468          dragEnabled="true" 
    467469                                > 
    468470                                                <!-- 
  • air/TLife/trunk/src/uwi/db/DB.as

    r2634 r2669  
    6767    } 
    6868     
     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     
    6976    public static function execute(conn : SQLConnection, text : String) : void 
    7077    { 
  • air/TLife/trunk/src/uwi/search/Searcher.as

    r2653 r2669  
    183183          rule : conds.join(" and "), 
    184184          type : 1, 
     185          highlighted : 0, 
    185186          numdisplay : 999, 
    186187          numnotify : 0, 
  • air/TLife/trunk/src/uwi/thread/MainThread.as

    r2651 r2669  
    137137      new PostEventThread().start(); 
    138138      new UndoThread(Application.application.postarea, Application.application.changeCharLeft).start(); 
     139      new MultipleTabBarDragEventThread(Application.application.tabbar).start(); 
    139140      new DataGridEventThread().start(); 
    140141      new DataGridRoutineThread().start(); 
  • air/TLife/trunk/src/uwi/thread/NotifyNewThread.as

    r2651 r2669  
    55  import flash.events.Event; 
    66  import ken39arg.logging.Logger; 
     7  import mx.controls.Button; 
    78  import mx.core.Application; 
    89  import org.libspark.thread.Thread; 
     
    4849      for each(var tabname : String in tabbar.titles) { 
    4950        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) { 
    5352          var sqlsuffix : String = " order by postid desc limit " + numnotify; 
    5453          var sql : String = null; 
     
    107106        var ret : SQLResult = dbst.Result; 
    108107        var ar : Array = ret.data; 
    109         if (ar != null) { 
     108        if (ar != null && ar.length > 0) { 
    110109          for each(var obj : * in ar) { 
    111110            posteridset2[obj.posterid] = null; 
     
    113112           
    114113          // 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; 
    120122          } 
    121123           
     
    124126      } 
    125127         
     128      tabbar.dispatchEvent(new Event("change_layout")); 
     129       
    126130      dbstmap2 = { }; 
    127131      pe = new ParallelExecutor(); 
     
    184188        for (i = 0; i < tl.length; i++) { 
    185189          status = tl[i]; 
     190          // Balloonの発言 
    186191          // TODO Formatterをつくる 
    187192          text += status.postername; 
     
    193198        b.baseY = getHighestBalloonY(); 
    194199         
    195         var f : Function = function(e : Event) : void { 
    196           b.removeEventListener(Event.CLOSING, f); 
     200        var f : Function = function(b_ : Balloon) : void { 
    197201          delete CommonData.balloons[b]; 
    198202        }; 
    199         b.addEventListener(Event.CLOSING, f)
     203        b.closeHandler = f
    200204        b.timeout = int(CommonData.configxml.balloon.timeout); 
    201205        b.open(false); 
  • air/TLife/trunk/src/uwi/thread/event/ContextMenuItemEventThread.as

    r2652 r2669  
    387387          newestid : -1,  
    388388          rule : "", 
     389          highlighted : 0, 
    389390          numnotify : -1, 
    390391          manageunread : -1, 
  • air/TLife/trunk/src/uwi/thread/event/DataGridEventThread.as

    r2651 r2669  
    1515  import uwi.util.CommonData; 
    1616  import uwi.util.EventThread; 
     17  import uwi.util.KeyBind; 
    1718  import uwi.util.Utility; 
    1819   
     
    8990     
    9091    /** 
    91      * up/down : select next/previous status. (default) 
    92      * left/right : select next/previous same poster's status. 
    9392     * @param e 
    9493     */ 
     
    9796      if (datagrid.selectedIndex == -1) datagrid.selectedIndex = 0; 
    9897       
    99       if (CommonData.keybindjudgers.jumptopostarea.apply(null, [e])) { 
     98      var code : int = KeyBind.encode(e); 
     99      if (CommonData.keybinds.jumptopostarea == code) { 
    100100        Application.application.postarea.setFocus(); 
    101101        next(waitEvents); 
     
    103103      } 
    104104       
    105       if(CommonData.keybindjudgers.replyattimeline.apply(null, [e])){ 
     105      if(CommonData.keybinds.replyattimeline == code){ 
    106106        CommonData.in_reply_to_status_id = ""; 
    107107        Application.application.appendReply(datagrid.selectedItem); 
    108108      } 
    109109       
    110       if (CommonData.keybindjudgers.sameuserforwardattimeline.apply(null, [e])) { 
     110      if (CommonData.keybinds.sameuserforwardattimeline == code) { 
    111111        datagrid.selectedIndex = Utility.searchSamePoster(timeline, datagrid.selectedIndex, 1); 
    112112        datagrid.scrollToIndex(datagrid.selectedIndex); 
     
    114114      } 
    115115       
    116       if (CommonData.keybindjudgers.sameuserbackwardattimeline.apply(null, [e])) { 
     116      if (CommonData.keybinds.sameuserbackwardattimeline == code) { 
    117117        datagrid.selectedIndex = Utility.searchSamePoster(timeline, datagrid.selectedIndex, -1); 
    118118        datagrid.scrollToIndex(datagrid.selectedIndex); 
  • air/TLife/trunk/src/uwi/thread/event/DataGridRoutineThread.as

    r2650 r2669  
    9090        var len : int = timeline.length - datagrid.maxVerticalScrollPosition + 1; 
    9191        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++) { 
    9393          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++){ 
    9595            var ir : DataGridItemRenderer = datagrid.rowcolToItemRenderer(i, j) as DataGridItemRenderer; 
    9696            if (ir == null) continue; 
  • air/TLife/trunk/src/uwi/thread/event/IncrementalSearchThread.as

    r2642 r2669  
    8080      switch(mode) { 
    8181      case 0: 
     82        var code : int = KeyBind.encode(e); 
    8283        for (var i : int = 1; i <= 4; i++) { 
    83           if (CommonData.keybindjudgers[KEYWORDS[i]].apply(null, [e])) { 
     84          if (CommonData.keybinds[KEYWORDS[i]] == code) { 
    8485            mode = i; 
    8586            CommonData.mainstatusbar.write(STR_SEARCH[mode], DEPTH_IST); 
  • air/TLife/trunk/src/uwi/thread/event/PostEventThread.as

    r2653 r2669  
    2525  import uwi.util.CommonData; 
    2626  import uwi.util.EventThread; 
     27  import uwi.util.KeyBind; 
    2728  import uwi.util.OAuthUtility; 
    2829  import uwi.util.Utility; 
     
    8182//      e.stopPropagation(); 
    8283       
    83       // \rが文字数にカウントされない現象の改善 
     84      // \rが文字数にカウントされない現象の改善(1行目の改行には反映されていない様子) 
    8485      if (e.keyCode == Keyboard.ENTER && (e.controlKey == true || e.altKey == true)) { 
    8586        e.preventDefault(); 
    8687        postarea.TextField.replaceSelectedText("\n"); 
     88        trace("にゃー"); 
    8789        postarea.TextField.dispatchEvent(EVENT_CHANGE); 
    8890      } 
     
    99101      } 
    100102       
    101       if (CommonData.keybindjudgers.jumptotimeline.apply(null, [e])) { 
     103      var code : int = KeyBind.encode(e); 
     104       
     105      if (CommonData.keybinds.jumptotimeline == code) { 
    102106        Application.application.datagrid.setFocus(); 
    103107        next(waitEvents); 
     
    105109      } 
    106110       
    107       if(CommonData.keybindjudgers.replyatpostarea.apply(null, [e])){ 
     111      if(CommonData.keybinds.replyatpostarea == code){ 
    108112        CommonData.in_reply_to_status_id = ""; 
    109113        Application.application.appendReply(datagrid.selectedItem); 
     
    112116      } 
    113117       
    114       if (CommonData.keybindjudgers.downatpostarea.apply(null, [e])) { 
     118      if (CommonData.keybinds.downatpostarea == code) { 
    115119        if (datagrid.selectedIndex == -1) datagrid.selectedIndex = datagrid.verticalScrollPosition; 
    116120        datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_DOWN, true, false, 0, Keyboard.DOWN)); 
     
    118122      } 
    119123       
    120       if (CommonData.keybindjudgers.upatpostarea.apply(null, [e])) { 
     124      if (CommonData.keybinds.upatpostarea == code) { 
    121125        if (datagrid.selectedIndex == -1) datagrid.selectedIndex = datagrid.verticalScrollPosition; 
    122126        datagrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_DOWN, true, false, 0, Keyboard.UP)); 
     
    124128      } 
    125129       
    126       if (CommonData.keybindjudgers.sameuserforwardatpostarea.apply(null, [e])) { 
     130      if (CommonData.keybinds.sameuserforwardatpostarea == code) { 
    127131        datagrid.selectedIndex = Utility.searchSamePoster(Application.application.timeline, datagrid.selectedIndex, 1); 
    128132        datagrid.scrollToIndex(datagrid.selectedIndex); 
     
    130134      } 
    131135       
    132       if (CommonData.keybindjudgers.sameuserbackwardatpostarea.apply(null, [e])) { 
     136      if (CommonData.keybinds.sameuserbackwardatpostarea == code) { 
    133137        datagrid.selectedIndex = Utility.searchSamePoster(Application.application.timeline, datagrid.selectedIndex, -1); 
    134138        datagrid.scrollToIndex(datagrid.selectedIndex); 
  • air/TLife/trunk/src/uwi/thread/event/TabBarEventThread.as

    r2634 r2669  
    22{ 
    33  import flash.events.Event; 
     4  import mx.collections.ArrayCollection; 
     5  import mx.controls.Button; 
    46  import mx.core.Application; 
     7  import mx.events.DragEvent; 
    58  import mx.events.ItemClickEvent; 
    69  import org.libspark.thread.Thread; 
     
    1821  { 
    1922    private var sub : EventThread; 
     23    private var sub2 : EventThread; 
    2024     
    2125    public function TabBarEventThread() 
     
    3438      sub = new EventThread(mtb, Event.CHANGE, onChange); 
    3539      sub.start(); 
     40      sub2 = new EventThread(mtb, "change_layout", onChangeLayout); 
     41      sub2.start(); 
    3642       
    3743      super.run(); 
     
    4046    private function onChange(e : Event) : void 
    4147    { 
     48      CommonData.tabmap[mtb.selectedTabName].highlighted = false; 
     49       
    4250      var ttt : TimelineThread = new TimelineThread(); 
    4351      ttt.start(); 
     
    5260      super.onItemClick(e); 
    5361    } 
     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    } 
    5474  } 
    5575   
  • air/TLife/trunk/src/uwi/ui/balloon/Balloon.mxml

    r2634 r2669  
    1717  resizable="false" 
    1818  creationComplete="onLoad()" 
    19     showStatusBar="false" 
    20     showTitleBar="false" 
     19  showStatusBar="false" 
     20  showTitleBar="false" 
    2121  showFlexChrome="false" 
     22  alwaysInFront="true" 
    2223  > 
    2324     
     
    4041      public var timeout : int; 
    4142      public var baseY : Number; 
     43      public var closeHandler : Function = null; 
    4244       
    4345      private var tfcontent : TextField; 
     
    6567        stage.nativeWindow.width = MAXWIDTH; 
    6668        stage.nativeWindow.height = MAXHEIGHT; 
    67          
    68         this.alwaysInFront = true; 
    6969      } 
    7070       
     
    7474        timer.stop(); 
    7575        timer = null; 
     76        if (closeHandler != null) closeHandler.apply(null, [this]); 
    7677        this.close(); 
    7778      } 
  • air/TLife/trunk/src/uwi/ui/mainmenu/MainMenu.mxml

    r2651 r2669  
    1010  remove="onRemove()" 
    1111  > 
    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> 
    1826  <mx:Label id="version" textAlign="right" width="100%" /> 
    1927   
  • air/TLife/trunk/src/uwi/ui/mainmenu/MainMenuEventThread.as

    r2642 r2669  
    66  import net.jirox.AirAutoUpdater; 
    77  import org.libspark.thread.Thread; 
     8    import uwi.db.DBExcite; 
    89    import uwi.thread.InitialMovementThread; 
    910    import uwi.twitter.TwitterOAuthRequestThread; 
     
    3233      event(mainmenu.oauth, MouseEvent.CLICK, onOAuthClick); 
    3334      event(mainmenu.checkupdate, MouseEvent.CLICK, onCheckUpdateClick); 
     35      event(mainmenu.cleardbmemory, MouseEvent.CLICK, onClearDBMemoryClick); 
    3436    } 
    3537     
     
    5557        CommonData.globalconfig.orderToFront(); 
    5658      } 
    57       next(run); 
    5859    } 
    5960     
     
    7071    } 
    7172     
    72     private function onCheckUpdateClick() : void 
     73    private function onCheckUpdateClick(e : MouseEvent) : void 
    7374    { 
    7475      PopUpManager.removePopUp(mainmenu); 
     
    7778      aau.checkUpdate(); 
    7879    } 
     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    } 
    7988  } 
    8089   
  • air/TLife/trunk/src/uwi/ui/multipletabbar/MultipleTabBar.as

    r2652 r2669  
    1919    public var tabheight : Number; 
    2020    private static const EVENT_CHANGE : Event = new Event(Event.CHANGE); 
     21    private static const EVENT_CHANGELAYOUT : Event = new Event("change_layout"); 
    2122     
    2223    public function MultipleTabBar(tabheight : Number = 20) { 
     
    7576      var ind : int = index != -1 ? index : selectedIndex; 
    7677      this.callLater(function() : void { 
     78        setSelectedIndexCore(ind); 
    7779        if (ind != selectedIndex) { 
    7880          dispatchEvent(EVENT_CHANGE); 
    7981        } 
    80         setSelectedIndexCore(ind); 
     82        dispatchEvent(EVENT_CHANGELAYOUT); 
    8183      }); 
    8284    } 
     
    9597      selectedIndex = sum + e.index; 
    9698      dispatchEvent(EVENT_CHANGE); 
     99      dispatchEvent(EVENT_CHANGELAYOUT); 
    97100      for each(var tab : TabBar in tablist) { 
    98101        if (tab != targ) tab.selectedIndex = -1; 
  • air/TLife/trunk/src/uwi/ui/tabconfig/TabConfigEventThread.as

    r2650 r2669  
    126126        newestid : -1,  
    127127        rule : "", 
     128        highlighted : 0, 
    128129        numnotify : -1, 
    129130        manageunread : -1, 
  • air/TLife/trunk/src/uwi/util/CommonData.as

    r2653 r2669  
    101101    public static var prevpos_replypost : int = -1; 
    102102 
    103     public static var keybindjudgers : Object; 
     103    public static var keybinds : Object; 
    104104     
    105105    public static var urlcache : Object = { }; // URL解決用のキャッシュ 
     
    117117    // type : int タブの種類 (0 : 通常のタブ, 1 : 検索結果タブ) 
    118118    // cache : Object 検索結果のキャッシュ 
     119    // highlighted : 強調するかどうか(0, 1) 
    119120    // --------以下はconfigxmlに格納-------- 
    120121    // numnotify : int  新着通知件数 (0 : 新着通知しない, 負 : グローバル設定に従う) 
  • air/TLife/trunk/src/uwi/util/KeyBind.as

    r2642 r2669  
    1010  public class KeyBind  
    1111  { 
    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    } 
    1316     
    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 
    7318    { 
    7419      src = src.toLowerCase(); 
    7520       
    7621      var keys : Array = src.split("+"); 
    77       if (keys.length == 0) return FUNCTION_FAILED
     22      if (keys.length == 0) return 0
    7823      var last : String = keys.pop(); 
    7924      var ctrl : Boolean = keys.indexOf("ctrl") != -1; 
     
    8126      var shift : Boolean = keys.indexOf("shift") != -1; 
    8227       
    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; 
    11881      } 
    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); 
    12383    } 
    12484  } 
    125    
    12685}