Is there any way to change default behavior of ESC key in AS3 (Adobe air 2.0 or above) ?
I have developed one application in fullscreen mode. I want to use "ESC" key to close currently opened window in this app. The problem here is that, it also fall back to Normal display state since ESC key is default key to turn off fullscreen mode.
Help plz, if you know the workaround.
Thanks.
Flash player doesn't allow to prevent exit from full screen, because it would be possible to block the browser, and it's possible only for Air application, here is example code:
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="init()">
<fx:Script>
<![CDATA[
private function init():void
{
nativeWindow.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
nativeWindow.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
private function onKeyDown(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.ESCAPE)
{
event.preventDefault();
}
}
]]>
</fx:Script>
</s:WindowedApplication>