5 Replies Latest reply on Sep 20, 2011 8:30 AM by Francisc

    Can't seem to be able to stop a Keboard Event in Mobile App

    Francisc Level 3

      Hello,

       

      Nice new face for the forum.

       

      It seems I cannot prevent the Keyboard event in a Mobile Application. Here's what I do inside the ViewNavigatorApplication:

       

      //In creationComplete handler

      NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN,keyPressedHand ler);

       

      //currentViewIsFirstView() is a method that returns true if the current active view is the first view of the application and false otherwise

      private function keyPressedHandler(event:KeyboardEvent):void

      {

          if(event.keyCode==Keyboard.BACK && currentViewIsFirstView())

          {

              event.preventDefault();

              event.stopImmediatePropagation();

              event.stopPropagation();

             

              //Show quit confirmation popup

          }

      }

       

      What happens is the event gets propagated and if I went to another view earlier in the process, it will slide views behind the "quit confirmation popup".

       

      How can I stop the damn event?

       

      Thank you.