1 Reply Latest reply on Dec 19, 2006 2:55 PM by UI Guy

    Trapping CTRL-F7 while not trapping F7

    UI Guy
      Background: I do a lot of work where I use Flash as an Interface prototype engine. Consequently, much of my material is driven by the Keyboard rather than mouse. (Actually, a lot of it is driven by an IR remote control masquerading as a keyboard; however, I digress...).

      I have a prototype where I am trapping a whole mess of Keystrokes and I need to be able to distinguish between CTRL-F7 and F7 in my trapping. Currently, whenever I capture CTRL-F7 (and it does work) it also fires off F7.

      Does anyone know how to avoid this quirk without tangling myself up in nested logic? It would seem to me that this should be UNIQUE...

      <SIMPLIFIED CODE>
      keyListener = new Object();
      keyListener.onKeyDown=function(){
      if(Key.isDown(Key.RIGHT)){
      chk_rightArrow.selected=true;
      txt_display.text="Right Arrow";
      txt_info.text="Keyboard Equivalent: RIGHT ARROW"
      }
      if(Key.isDown(Key.CONTROL) && Key.isDown(Key.RIGHT)){
      chk_next.selected=true;
      txt_display.text="Next";
      txt_info.text="Keyboard Equivalent: CTRL-RIGHT";
      }
      }
      Key.addListener(keyListener);

      Many thanks,

      UI Guy
        • 1. Re: Trapping CTRL-F7 while not trapping F7
          UI Guy Level 1
          As a follow-up - The following code solves this problem - but is there a better way?

          keyListener = new Object();
          keyListener.onKeyDown=function(){
          if(Key.isDown(Key.RIGHT)){
          if(Key.isDown(17)){
          chk_next.selected=true;
          txt_display.text="Next";
          txt_info.text="Keyboard Equivalent: CTRL-RIGHT";
          }
          else{
          chk_rightArrow.selected=true;
          txt_display.text="Right Arrow";
          txt_info.text="Keyboard Equivalent: RIGHT ARROW"
          }
          }
          }
          Key.addListener(keyListener);