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

Disable Default function of "Back" button for Android.

Contributor ,
Aug 11, 2013 Aug 11, 2013

Hi there!

I have tried SO MANY methods to PREVENT the default function of Back button in Android but no success

This is one of the codes I have used with no success:

stage.addEventListener(KeyboardEvent.KEY_UP, optionsKey, false, 0, true);

function optionsKey(ke:KeyboardEvent):void
{

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

            ke.preventDefault();
            ke.stopImmediatePropagation();

         

          //Do my own code below...

     }

}

I am using Flash Cs6 , Air 3.2 for Android , Testing it on LG Google nexus 4.

When I use the flash simulator, it works fine! Means the Back Button, let the App go back to previous step (as I expect it to do)

But after I publish the apk (Aspect ratio: Auto , Auto orientation , Render mode: GPU), as soon as I press BACK, it minimize my app!

(means when i press the Back button on my phone, the App minimize down (not close!). when I re-activate it/click on it, I see the app has actually gone one step BACK (as I programmed and expected), but I just CANT STOP the default action of MINIMIZING/De-activating my app after pressing Back button.

Anyone have any "Fla" file that I can see it in ACTION please?!

Because I have used many-many codes and no success yet

thanks and looking forward for your any kind of hlep...

Message was edited by: Pouradam

TOPICS
ActionScript
1.5K
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

correct answers 1 Correct answer

Contributor , Aug 12, 2013 Aug 12, 2013

I got my own answer thanks to myself!!

in above code .KEY_UP should be changed to .KEY_DOWN.

simple!

Translate
Contributor ,
Aug 11, 2013 Aug 11, 2013

No answer???? ....

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
Contributor ,
Aug 12, 2013 Aug 12, 2013
LATEST

I got my own answer thanks to myself!!

in above code .KEY_UP should be changed to .KEY_DOWN.

simple!

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