carly31
2/2/2016 - 5:58 AM

air mobile - back button

 function onKeyPress(ev:KeyboardEvent):void
        {
            switch(ev.keyCode)
            {
                case Keyboard.BACK: // user hit the back button on Android device
                // case 94: // was hard-coded for older build of SDK supporting eclair
                { 
                    if(null != _currentScreen)
                    {
                        // TO DO - make this smarter?
                        if(_currentScreen.goBack())
                        {
                            // don't let the OS kill focus to our app
                            ev.preventDefault();
                            ev.stopImmediatePropagation();
                        }
                    }
                    break;
                }

          }