Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

controlling Flash/Animate scene from android keypress/return button

New Here ,
May 23, 2017 May 23, 2017

I am trying to return a Flash/Animate animation published as Air for Android App from one scene to another using the Android return button/keypress. Is this possible and is there Action Script to enable this. I would be very grateful for any guidance with this issue. Many thanks

Zeb

TOPICS
ActionScript
248
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 23, 2017 May 23, 2017
LATEST

The whole handling the back arrow correctly is a requirement of some of the app stores, especially the Samsung store, so it's good that you're trying to do that.

These lines show the general approach:

//trap the system press of any key

  NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, fl_OptionsBackHandler);

//check if the key is the back arrow. If the my variable 'atcontents' is true, 'return', which will have the effect of allow Android to exit the app

//if it's not true, do the code to take you to your contents page, and stop the back arrow from reaching Android OS

function fl_OptionsBackHandler(event:KeyboardEvent):void {

  if (event.keyCode == Keyboard.BACK) {

    if (atcontents) {

     return;

    } else {

      goToContents();

      event.preventDefault();

      event.stopImmediatePropagation();

   }

  }

  event.preventDefault();

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines