Copy link to clipboard
Copied
Hi guys, I'm trying to check if the time is right to play mouseover animation for certain element. I placed a variable on the 1st frame of the timeline called "this.time_is_up = false;" and in the 88th frame "this.time_is_up = true;"
Outside the canvas element I have the following code:
<script>
var canvas, stage, exportRoot, bgExit;
function init() {
canvas = document.getElementById("canvas");
bgExit = document.getElementById('background_exit');
images = images||{};
addListeners();
var loader = new createjs.LoadQueue(false);
loader.addEventListener("fileload", handleFileLoad);
loader.addEventListener("complete", handleComplete);
loader.loadManifest(lib.properties.manifest);
}
function handleFileLoad(evt) {
if (evt.item.type == "image") { images[evt.item.id] = evt.result; }
}
function handleComplete(evt) {
exportRoot = new lib._XXX_BANNER_XXX_306X230_NL_Promotor();
stage = new createjs.Stage(canvas);
stage.addChild(exportRoot);
stage.update();
stage.enableMouseOver();
createjs.Ticker.setFPS(lib.properties.fps);
createjs.Ticker.addEventListener("tick", stage);
document.getElementsByTagName('canvas')[0].addEventListener( 'mouseover', function() {
exportRoot.mcHolder.children[0].mcButton.gotoAndPlay('over');
});
In the last bit of code, I need to put an if statement, if (time_is_up == true;) to goAndPlay certain animation. But the variable time_is_up is not visible from outside HTML file. Please help me to get to it.
Copy link to clipboard
Copied
exportRoot.time_is_up is the correct reference. but it will be undefined until the code in your 1st frame executes.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now