Copy link to clipboard
Copied
I don't understand javascript - I needed to produce a simple animation in animate cc output to html 5 canvas.
I have liberated, then bodged this code from a forum.
The animation behaves itself by pausing at being, when I press the play button, it plays, it reverses when I press reverse button, and it stops at the end. Which is all super. But I cannot work out what to put to make it stop/pause when I press my stop button - I have removed the bits that don't work.
this.stopButton.addEventListener("click", fl_MouseClickHandler_7.bind(this));
function fl_MouseClickHandler_7()
{
this.Stop();
}
from code snippets doesn't work.
Can anyone help?
Thanks in anticipation
debra
this.stop();
this.playButton.addEventListener("click", playForwards.bind(this));
function playForwards() {
if (createjs.Ticker.hasEventListener("tick")) {
createjs.Ticker.removeAllEventListeners();
}
createjs.Ticker.addEventListener("tick", playF.bind(this));
}
function playF(e) {
this.gotoAndStop(this.currentFrame + 1);
if ((this.currentFrame == 155)) {
createjs.Ticker.removeAllEventListeners();
}
stage.update();
}
this.reverseplayButton.addEventListener("click", playReverse.bind(this));
function playReverse() {
if (createjs.Ticker.hasEventListener("tick")) {
createjs.Ticker.removeAllEventListeners();
}
createjs.Ticker.addEventListener("tick", playR.bind(this));
}
function playR(e) {
this.gotoAndStop(this.currentFrame - 1);
if ((this.currentFrame == 155)) {
createjs.Ticker.removeAllEventListeners();
}
stage.update();
}
this.Stop();
should be this.stop();
ie, case-counts.
Copy link to clipboard
Copied
this.Stop();
should be this.stop();
ie, case-counts.
Copy link to clipboard
Copied
When something isn't working, always, always, always check the developer console for error messages.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now