3 Replies Latest reply on Aug 9, 2008 10:30 AM by justria

    Disabling keyboard shortcuts

    justria Level 1
      I have a small app, which contains a Canvas and a HSlider in one window.

      If I click once in the HSlider, the HSlider further consumes all <ShiftLeft> and <ShiftRight> keyboard events. Unfortunately, I need these events to be consumed by the Canvas.

      I registered
      quote:

      stage.addEventListener( KeyboardEvent.KEY_DOWN, handleKeyboard );

      early when the respective state appears and I handle the keyboard like this
      quote:

      private function handleKeyboard( e:KeyboardEvent ):void {

      if ( Keyboard.LEFT == e.keyCode ) {
      // Something
      } else if ( Keyboard.RIGHT == e.keyCode ) {
      // Something
      } else if ( Keyboard.UP == e.keyCode ) {
      // Something
      } else if ( Keyboard.DOWN == e.keyCode ) {
      // Something
      }
      }


      While the Keyboard.UP and Keyboard.DOWN reach the Canvas, the Keyboard.LEFT and Keyboard.RIGHT never reach it, once I changed the HSlider once.

      Any ideas, how to work around this?