0

I have an application intended to run in full screen mode. In order to prevent it from getting out of full screen I did:

protected function windowedapplication_preinitializeHandler(event:FlexEvent):void
{
     nativeWindow.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
     nativeWindow.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}

protected function onKeyDown(event:KeyboardEvent):void
{
   if (event.keyCode == 27)
   {
      event.preventDefault();
    }
}

That prevents the app getting out of full screen but my app has a video player with an option to go full-screen with the video and at that point when i press esc the whole app and the video come to smaller size.

Thanks in advance!

sstauross
  • 2,602
  • 2
  • 30
  • 50
  • I was pretty sure that with the browser based Flash Player it is not possible to prevent people from going out of full screen mode. Forcing people into full screen and not letting them get out, essentially, hijacks their computer. Are you using AIR? I thought it had similar issues/limitations--which is frustrating if you want to build a kiosk style application. – JeffryHouser Jul 31 '12 at 15:56
  • yes exactly, i develop a kiosk application with air, what can i do for that? – sstauross Jul 31 '12 at 16:00
  • I don't think there is anything you can do to force AIR to stay in full screen mode, although I haven't explored this since the pre 1.0 days. At the time I was told "Kiosk mode was not a development priority." As far as I know it never became one. If you're too late to switch technologies you may look into something like running an alternate non-AIR program that watches the AIR window and sets it back to full screen if it goes out. It seems overly complex, though. – JeffryHouser Jul 31 '12 at 16:15
  • i was thinking about making modification to the fullscreen/normalscreen button when at fullscreen when it is pressed prevent the app from getting back to normal, is it feasible? – sstauross Jul 31 '12 at 16:21
  • You'll have to test to find out. I thought you could always get out of full screen mode by pressing the escape key; but you'll have to check to be sure. – JeffryHouser Jul 31 '12 at 16:24

2 Answers2

0

You couldn't prevent ESC key to exit from full screen mode. This is security issue.

yrunts
  • 153
  • 8
  • i did it with the code provided above! the problem is when a video is at fullscreen on escape both the video and the app minimizes... – sstauross Aug 01 '12 at 09:08
0

You can listen for the FullScreenEvent and set the stage.displayState to return back to full screen when FullScreenEvent.FULL_SCREEN is dispatched.

This way, the app will change back to full screen even when the user clicks the full screen button to exit full screen mode in the video player.

private function onApplicationComplete(event:Event):void{

      stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
      stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullScreenChange);

}

private function onFullScreenChange(event:FullScreenEvent):void{

      stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
}
softineer
  • 1
  • 1