Fullscreen on HTML5

yoplalala

  • *
  • Posts: 1632
Do somebody know how to use fullscreen on html5 ?

mdotedot

  • Posts: 1654
For full screen to work you need player interaction. I've changed the generated index.html to accomodate:

Replace the body script with something like this:
Code: [Select]


<body style='cursor: pointer'  onclick="document.body.removeChild(document.getElementById('click'));
if(document.getElementById('openfl-content').name===undefined){ document.getElementById('openfl-content').name='openfl-content';if (
    document.fullscreenElement ||
    document.webkitFullscreenElement ||
    document.mozFullScreenElement ||
    document.msFullscreenElement || document.webkitEnterFullscreen
  ) {
    if (document.exitFullscreen) {
      document.exitFullscreen();
    } else if (document.mozCancelFullScreen) {
      document.mozCancelFullScreen();
    } else if (document.webkitExitFullscreen) {
      document.webkitExitFullscreen();
    } else if (document.msExitFullscreen) {
      document.msExitFullscreen();
    }
  } else {
    element = document.documentElement;
if (element.webkitEnterFullScreen){
element.webkitEnterFullScreen();
} else if (element.requestFullscreen) {
      element.requestFullscreen();
    } else if (element.mozRequestFullScreen) {
      element.mozRequestFullScreen();
} else if (element.webkitRequestFullScreen) {
      element.webkitRequestFullScreen();
   
    } else if (element.webkitRequestFullscreen) {
      element.webkitRequestFullscreen();
    } else if (element.msRequestFullscreen) {
      element.msRequestFullscreen();
    }

  }    lime.embed ('YourGameName', 'openfl-content', 1280, 640, { parameters: {} });  }"  >


<div id="openfl-content" ></div>

<div id='click' style='position:absolute; top:256px; left:256px; color:blue;'> <H1 > CLICK TO START </H1> </div>

</body>
</html>

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.