$CENTER_STYLE $ANIMATE_CC_SCRIPTS $SCRIPT_START var canvas, stage, exportRoot, anim_container, dom_overlay_container, fnStartAnimation; var anim__Datas = []; var anim__Names = new Array(); function init() { canvas = document.getElementById("$CANVAS_ID"); anim_container = document.getElementById("$ANIM_CONTAINER_ID"); dom_overlay_container = document.getElementById("dom_overlay_container"); $CREATE_LOADER loader.addEventListener("progress", handleProgress); var lib=comp.getLibrary(); if (manifest) { for (var i = 0; i < manifest.length; i++) { lib.properties.manifest.push(manifest[i]); } } loader.loadManifest(lib.properties.manifest); $PRELOAD_ASSETS } $HANDLE_FILE_LOAD_START $HANDLE_FILE_LOAD_BODY if (evt && (evt.item.type == "text")) { anim__Datas[evt.item.id] = evt.result; anim__Names.push(evt.item.id); } $HANDLE_FILE_LOAD_END $HANDLE_COMPLETE_START //This function is always called, irrespective of the content. You can use the variable "stage" after it is created in token create_stage. $CREATE_STAGE //Registers the "tick" event listener. $START_ANIMATION //Code to support hidpi screens and responsive scaling. $RESP_HIDPI // InitAS2(); $HANDLE_COMPLETE_END function handleProgress(evt) { preloader = document.getElementById("preloader"); percents = document.getElementById("percents"); img = document.getElementById("preloader_img"); if (img.offsetWidth > window.innerWidth) { img.style.width = (window.innerWidth*0.9) + "px"; img.style.marginLeft = "0px"; img.style.left = "5%"; img.style.marginTop = -1*(img.offsetHeight + 20) + "px"; } if (evt.progress < 1) { var percent = Math.floor(evt.progress*100); percents.innerHTML = "Game is loading "+percent+"%"; } else { //preloader.parentNode.removeChild(preloader); } } $PLAYSOUND $SCRIPT_END