1 Reply Latest reply on Sep 14, 2007 10:00 AM by padrepio

    Keyboard Events

    padrepio Level 1
      I've been reading about the KeyboardEvent listener, specifically, KEY_DOWN. Am I correct in understanding that keyboard events have to be attached to the stage and not an object?

      stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyDown);
      function KeyDown(event:KeyboardEvent):void {
      if (event.keyCode == Keyboard.ENTER) {
      navigateToURL(link);
      }
      }

      This example works, but I want to trigger it from a button. Is that possible or unnecessary?
      What about the Keyboard event initialize?