I am trying to proven the default functionality of the Android home screen button but the KeyboardEvent.KEY_UP event does not fire when the home key is pressed the the tablet i have. (eee transformer prime) Is there another why to detect and stop this functionality?
Here is the code that i am trying to user
import mx.events.FlexEvent;
// Add the hardware key event handlers to the stage.
protected function appCompleteHandler(event:FlexEvent):void {
stage.addEventListener(KeyboardEvent.KEY_DOWN, handleButtons,false, 1);
stage.addEventListener(KeyboardEvent.KEY_UP, handleButtons,false, 1);
}
// Event handler to handle hardware keyboard keys.
protected function handleButtons(event:KeyboardEvent):void
{
trace("Event fired");
if (event.keyCode == Keyboard.HOME) {
event.preventDefault();
trace("home");
} else if (event.keyCode == Keyboard.BACK) {
// Hanlde back button.
event.preventDefault();
trace("back");
}
}