How goto fullscreen HTML5 target

Target - HTML5.
I try goto fullscreen mode 2 ways.

First way is using stage.displayState, but when I do this:

stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

then nothing happens.

Second way is calling javasctipt functions from this article
In this case browser goes to fullscreen mode, but instead my application I see black screen.

Looks like doing it via stage.displayState is only available using Flash:

I don’t have a solution yet but as for the other way, which element are you using to request the full screen? Did you try passing the canvas element which holds the OpenFL? Or the div#openfl-content?

Using Chrome, if I open the console and type:


this works for me.

Yes, I try




and after this I see black fullscreen.

Have you added anything to your stage prior to calling this? Sounds like just the backdrop is showing.
Sorry if this is a dumb question.

Empty project with only red square works correctly, but other project with many graphics doesn’t work.

I’ve had trouble with the HTML5 target updating its display before. What happens if you move an element slightly, directly after entering full screen? Like mysprite.x += 1;

Moving sprite does not affect anything.
But I detected, that black screen appears in chrome, but in firefox all is good.

I found solution in this article!msg/chrome/MJjuK65Exkg/IpC668uFw2sJ, but I don’t know how solve this problem without correcting chrome shortcut.

I wonder what happens if you try a different HTML5 generator:

 openfl test html5 -Dcanvas

Looks like blackness is a problem with WebGL: -Dcanvas vs -Dwebgl vs -Ddom?

How I can change HTML5 generator in my project? I use FlashDevelop.

In your project.xml, use:

<haxedef name="canvas" if="html5" />


<haxedef name="dom" if="html5" />

Anyway appears black screen.

I am out of ideas. :slight_smile:

Do you have working sample?

As you use FlashDevelop, what’s the build command in the output panel, it might be that FlashDevelop uses webgl key to compile.
My advice is to type& run the command in the console directly, to make sure that what you enter is what you actually get.

When I try exit from fullscreen, I press ‘Esc’, but there is no event KeyboardEvent.KEY_DOWN. And I can’t track the moment of exit from fullscreen by pressed ‘Esc’ button.

I solved this by events from javascript, but javasctipt does not react to F11.

For the record, this is Haxe’s documentation, so it doesn’t necessarily apply to OpenFL. The main point of OpenFL is to take Flash-only features and make them work on other platforms.

That said, OpenFL hasn’t finished implementing all of Flash’s features, and stage.displayState seems to be one of the unfinished features.