I have read several posts regarding FullScreen in OpenFL but none of them work for me.
I have a FullScreen toggle button to toggle it with FullScreen and Normal mode.
To toggle to FullScreen mode
stage.displayState = StageDisplayState.FULL_SCREEN;
To toggle to Normal mode
stage.displayState = StageDisplayState.NORMAL;
It’s not working. Please note that my target is HTML 5.
I AM STRUGGLING WITH THIS ISSUE FOR WEEKS NOW… PLS HELP
What do you mean by not working - completely nothing happens when you set that displayState? I’ve recently tested it in my project and it seems to work upscaling everything to the screen’s resolution.
Very strange. How come it’s working for you ?
Does the content also scales up to full screen ?
In my case only the content does not scale to full screen and the rest of the space is filled with white when toggled to full screen
So you’ve now disclosed something really important - you get the fullscreen but content is not scaled up. So for the content to scale up I’d add some additional code. I personally use this like this. It works but there may be other approaches. Test it out for yourself (I’ve written it in here, without testing). I’m pretty sure .SHOW_ALL does the trick here. Try it out.
this.stage.addEventListener(FullScreenEvent.FULL_SCREEN, function(e:FullScreenEvent){
if (e.fullScreen) {
try{
stage.scaleMode = StageScaleMode.SHOW_ALL;
stage.align = StageAlign.TOP_LEFT;
} catch (e:SecurityError) {
// ... sometimes this happens, I do nothing in here, just catching it
}
} else {
// ... back to .NO_SCALE here
}
});
Perhaps it’s just our letterboxing effect that’s not working fully, here. It should work to allow full-size, and to handle Event.RESIZE after changing to fullscreen (I’ve tested this before with PiratePig and it worked)
I have used your example and observed the following things.
Since you have defined ‘resizable = true’, the screen resizes itself before launch and then if you click on fullscreen it further scales up the content.
Please note that this is not the fullscreen functionality which flash actually does with StageDisplayState.FULL_SCREEN.
Firstly, it should not automatically scale up after launch and should stay at its original size.
Secondly, it should do a proper FullScreen as achieved by StageDisplayState.FULL_SCREEN in Flash.
@tour1st : Even your suggestion does not work as expected.