Return to Snippet

Revision: 34849
at October 29, 2010 02:19 by sidneydekoning


Initial Code
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);

			
private function onKeyDown(event:KeyboardEvent):void
{
	if (event.keyCode == Keyboard.BACK) {
		event.preventDefault();
		log.appendText("Back Pressed\n");
	} 
	else if (event.keyCode == Keyboard.MENU) {
		event.preventDefault();
		log.appendText("Menu Pressed\n");
	} 
	else if (event.keyCode == Keyboard.SEARCH) {
		event.preventDefault();
		log.appendText("Search Pressed\n");
	}
}

Initial URL

                                

Initial Description
As an added bonus you also have access to the keys on your device. Most devices have an HOME, MENU and SEARCH button on the device itself. Of course you can access them. Add an normal key down listener to the stage and respond to it.

Initial Title
Accessing System keys in AIR for Android

Initial Tags

                                

Initial Language
ActionScript 3