Skip to main content
Participant
May 2, 2018
Answered

Adding a line of code to HTML5 output init() function

  • May 2, 2018
  • 1 reply
  • 731 views

I have a need to add a couple of lines of code to the end of the init() function...used by my engine. Currently I have to manually add it every time I re-publish my content. Is there a way to have it automatically add it every time I re-publish?

function init() {

canvas = document.getElementById("canvas");

anim_container = document.getElementById("animation_container");

dom_overlay_container = document.getElementById("dom_overlay_container");

var comp=AdobeAn.getComposition("9249BD2A01D4914B9F884593FD1C9237");

var lib=comp.getLibrary();

var loader = new createjs.LoadQueue(false);

loader.addEventListener("fileload", function(evt){handleFileLoad(evt,comp)});

loader.addEventListener("complete", function(evt){handleComplete(evt,comp)});

var lib=comp.getLibrary();

loader.loadManifest(lib.properties.manifest);

    // ADDED CODE

    window.parent.nextType = "timer";

    window.parent.iframe_loaded();

}

    This topic has been closed for replies.
    Correct answer ClayUUID

    Is there any particular reason you can't just put those two lines of code in the first frame of your root timeline?

    1 reply

    JoãoCésar17023019
    Community Expert
    Community Expert
    May 2, 2018

    Hi.

    Is this the html generated by Animate CC, isn't it?

    Go to the Publish Settings > Advanced tab and set Animate to not override this template when publishing.

    Participant
    May 2, 2018

    Hi there,

    Yes, you are correct, it is the HTML generated by Animate CC. I will give your suggestion a shot.

    My only issue with that is that if I add script to the Global>>Script file, it adds that to the beginning of the HTML output which necessitate the need to overwrite the HTML.

    I am just beginning to transition from ActionScript to JavaScript output Animate...perhaps I will try using a separate .js file with the JavaScript code I need and use the Global>>Include to eliminate the need to update the HTML file.

    Thanks

    ClayUUIDCorrect answer
    Legend
    May 2, 2018

    Is there any particular reason you can't just put those two lines of code in the first frame of your root timeline?