Back button for android is not working for apk file.
I am using Flash CS6 to create an android app. I am trying to code for my back button. It works well when i run the file in flash but after I published it out into my handphone, the back button brings me from page 3 to page 1 instead of from page 3 to page 2. I am doing my coding in the frame itself and not by class.
The code i have used is below:
import flash.events.MouseEvent;
import flash.events.KeyboardEvent;
import flash.desktop.NativeApplication;
stop();
NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler159)
function onKeyDownHandler159(event:KeyboardEvent):void
{
if( event.keyCode == Keyboard.BACK)
{
event.preventDefault();
event.stopImmediatePropagation();
NativeApplication.nativeApplication.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler159);
gotoAndStop (14);
NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler159)
}
}
