How goto fullscreen HTML5 target


#1

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 https://davidwalsh.name/fullscreen.
In this case browser goes to fullscreen mode, but instead my application I see black screen.


#2

Looks like doing it via stage.displayState is only available using Flash: http://api.haxe.org/flash/display/StageDisplayState.html

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?


#3

Using Chrome, if I open the console and type:

document.getElementById("openfl-content").webkitRequestFullscreen();

this works for me.


#4

Yes, I try

document.getElementById("openfl-content").webkitRequestFullscreen();

and

document.documentElement.webkitRequestFullscreen();

and after this I see black fullscreen.


#5

Have you added anything to your stage prior to calling this? Sounds like just the backdrop is showing. https://www.sitepoint.com/use-html5-full-screen-api/
Sorry if this is a dumb question.


#6

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


#7

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;


#8

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


#9

I found solution in this article https://productforums.google.com/forum/#!msg/chrome/MJjuK65Exkg/IpC668uFw2sJ, but I don’t know how solve this problem without correcting chrome shortcut.


#10

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

 openfl test html5 -Dcanvas

#11

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


#12

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


#13

In your project.xml, use:

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

or:

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

#14

Anyway appears black screen.


#15

I am out of ideas. :slight_smile:


#16

Do you have working sample?


#17

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.


#18

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.


#19

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


#20

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.