1 Reply Latest reply on Nov 10, 2009 10:49 PM by viatropos

    Intercept Browser Keyboard Handling???

    viatropos Level 1

      I would like to be able to use the COMMAND-W Mac "close-window" keyboard shortcut in a Flash application.

       

      I understand how to use keyboard events, but I can't figure out how to prevent the browser from handling the keyboard events too. Specifically, COMMAND-T for new tabs, COMMAND-Q to quit, and COMMAND-W for closing a window.

       

      I know I could use CTRL-(KEY) in some of the situations, but I would like to be able to use the COMMAND key as that is the most natural.

       

      Is this even possible?

       

      Is there some conditional javascript I could use out there?

       

      Thanks for the help,

      Lance

        • 1. Re: Intercept Browser Keyboard Handling???
          viatropos Level 1

          I am able to hear ALT/CTRL/CMD keyboard events from javascript using the following, but it doesn't hear any other keys?!?

           

          <script language="JavaScript" type="text/javascript">

           

          document.onkeydown = function(event) {applicationKeyboardHandler(event)}

          document.onkeypress = function(event) {applicationKeyboardHandler(event)}

           

          function handleKeys(e) {

          alert("Key Pressed")

          }

           

          </script>

           

          What am I missing?