Making flash game go full screen

Monkey Archive Forums/Monkey Tutorials/Making flash game go full screen

Aman(Posted 2011) [#1]
Paste this code before [public function MonkeyGame()]
public function _handleClick(event:MouseEvent):void{
  if (stage.displayState == StageDisplayState.NORMAL) {	
	stage.displayState=StageDisplayState.FULL_SCREEN_INTERACTIVE;
  }
}

paste this code at the end of [public function MonkeyGame()]
stage.addEventListener(MouseEvent.CLICK, _handleClick);


This will make your flash game go full screen whenever the user click anywhere inside the game.


Soap(Posted 2011) [#2]
I would also add options in the game to enable/disable constant fullscreen.

It is worth noting that only mouse is enabled while in fullscreen mode as far as I know - to prevent phishing attempts. Because of this it may be better to stretch your game to the size of the browser window and then suggest to players that they press F11 to go into fullscreen mode.


Aman(Posted 2011) [#3]
This depends, FULL_SCREEN_INTERACTIVE allow you to use the keyboard but it works only with AIR 1.0 and Flash Lite 4. For Flash Player, it works just like FULL_SCREEN. I like your idea but you cannot do this in monkey.


Soap(Posted 2011) [#4]
What I described can be done with a Monkey app. Use Diddy's virtual resolution and then scale the game to the size of the browser's window with JS. Then encourage the user to press F11.

I'm talking about Flash apps running in the browser.


Aman(Posted 2011) [#5]
This code above can be customized to be easily imported by monkey, unlike what you mentioned which has to be added after build gets generated. Diddy's virtual resolution uses the width and height of the flash file. It won't use the size of the window. It would have been great to change the flash dimensions instead of this ugly flash scale.


Soap(Posted 2011) [#6]
Well, sure, what I described has to be added after, but there are several platform specific things like this which you have to do after leaving Monkey. :) You can change the size of a Flash window with Javascript - you could scale it to the size of the Browser window so it fits nicely. That's what I was talking about.