Skip to main content
Known Participant
September 30, 2022
Answered

How to make fullscreen view directly (HTML5)

  • September 30, 2022
  • 1 reply
  • 944 views

How to make fullscreen directly when I test movie in animate CC ?

I try this script, but it seems doesnt work :

//here's the code

this.on("tick", full.bind(this));

var ancs = 0

function full(e) {
fullscreen()
}

var isInFullScreen = (document.fullscreenElement && document.fullscreenElement !== null) ||
(document.webkitFullscreenElement && document.webkitFullscreenElement !== null) ||
(document.mozFullScreenElement && document.mozFullScreenElement !== null) ||
(document.msFullscreenElement && document.msFullscreenElement !== null);

var docElm = document.documentElement;

function fullscreen() {

if (!isInFullScreen) {
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
} else if (docElm.msRequestFullscreen) {
docElm.msRequestFullscreen();
}

}
}

//end of code

I need some help, please...

    This topic has been closed for replies.
    Correct answer kglad

    you can't do that. (thankfully) browsers prevent that.  you must have user interaction with a browser displayed stage.

    1 reply

    kglad
    Community Expert
    Community Expert
    September 30, 2022

    put something on stage to click (it can have alpha = 0).

     

    and you probably want to edit your publish settings to center your stage and possibly make your stage responsive and fit.  ie, test the various settings to get the effect you want.

    Known Participant
    September 30, 2022

    Hi, Kglad...

    I want my project directly in fullscreen view, without any click of button. The 'tick' function seems not working.

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    September 30, 2022

    you can't do that. (thankfully) browsers prevent that.  you must have user interaction with a browser displayed stage.