How goto fullscreen HTML5

I know that if i want to go full screen it shoud be mouse event or touch event, but it still doesnt work.
anyone knows how to make it work?

It is working for me:

https://98w1owr5lp.codesandbox.io

(It has to run in its own window to properly go fullscreen, but the code used is here below:)

it doesnt work on starling touch events

I’m getting errors like these on Chrome Version 72.0.3626.81 (Official Build) (64-bit)

Uncaught (in promise) TypeError: fullscreen error
at Y.setFullscreen (client.js:361)
at sd.set_fullscreen (client.js:533)
at Ld.set_displayState (client.js:1219)
at setMaximised (client.js:294)
at se.onClickMaximise (client.js:293)
at Ud.c [as callback] (client.js:12)
at Vb.__dispatchEvent (client.js:45)
at Vb.__dispatchEvent (client.js:63)
at Vb.__dispatchWithCapture (client.js:64)
at Vb.dispatchEvent (client.js:60)

openfl.min.js:2 Uncaught (in promise) TypeError: fullscreen error
at p.setFullscreen (openfl.min.js:2)
at o.set_fullscreen (openfl.min.js:2)
at P.set_displayState (openfl.min.js:2)
at P.set (openfl.min.js:2)
at r.eval [as callback] (app.js? [sm]:26)
at E.__dispatchEvent (openfl.min.js:2)
at E.__dispatch (openfl.min.js:2)
at E.__dispatch (openfl.min.js:2)
at P.__dispatchStack (openfl.min.js:2)
at P.__onMouse (openfl.min.js:2)
at P.onMouseDown (openfl.min.js:2)
at i (openfl.min.js:2)
at Array.eval (openfl.min.js:2)
at a.dispatch (openfl.min.js:2)
at p.handleMouseEvent (openfl.min.js:2)
at HTMLDivElement.i (openfl.min.js:2)

Is anyone else experiencing the same thing? Is this expected? Is there a workaround?

Thanks.

Is that on this link?

https://98w1owr5lp.codesandbox.io/

The second one, yes:

openfl.min.js:2 Uncaught (in promise) TypeError: fullscreen error
at p.setFullscreen (openfl.min.js:2)
at o.set_fullscreen (openfl.min.js:2)
at P.set_displayState (openfl.min.js:2)
at P.set (openfl.min.js:2)
at r.eval [as callback] (app.js? [sm]:26)
at E.__dispatchEvent (openfl.min.js:2)
at E.__dispatch (openfl.min.js:2)
at E.__dispatch (openfl.min.js:2)
at P.__dispatchStack (openfl.min.js:2)
at P.__onMouse (openfl.min.js:2)
at P.onMouseDown (openfl.min.js:2)
at i (openfl.min.js:2)
at Array.eval (openfl.min.js:2)
at a.dispatch (openfl.min.js:2)
at p.handleMouseEvent (openfl.min.js:2)
at HTMLDivElement.i (openfl.min.js:2)

Sorry, no. This link:

As in, when the canvas does not occupy the whole page.

Yeah, I think in that version, they might block fullscreen in the editor

I made openfl button, alpha to 0 and and put it on top of starling button, it’s kind a solution but not really nice :smiley:

Oh, you can also do it by listening to OpenFL events

Starling events are queued, which works in Flash but disconnects the click from the user’s event, breaking the permissions model for HTML5. OpenFL events are dispatched immediately, so if you listen to stage.addEventListener or some other OpenFL object, you can do it.

I suppose the alpha=0 object accomplishes that :stuck_out_tongue:

:smiley: :smiley: Thanks Joshua :wink: