I am building a kiosk game for a trade show and want to prevent users from exiting fullscreen with ESC.
I am using Flash CS6 IDE.
I can trap the ESC key with a onKeyDown event, but I can't prevent the ESC key from exiting fullscreen on the Windows executable.
I saw a post with a solution for AIR and Flex and saw your note about stage.nativeWindow as the thing to use in Flash IDE, but I am getting a "Access of possibly undefined property nativeWindow through a reference with static type flash.display:Stage." error.
Here is the code I am using:
function init():void
{
stage.nativeWindow.addEventListener(KeyboardEvent.KEY_DOWN, escapeTrap);
stage.nativeWindow.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
function escapeTrap(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.ESCAPE)
{
event.preventDefault();
}
}
Thanks!