/ Published in: ActionScript 3
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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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"); } }