Skip to main content
debrap71321954
Participant
March 20, 2018
Answered

Please help - can't get animate canvas stop button to work

  • March 20, 2018
  • 2 replies
  • 565 views

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 topic has been closed for replies.
    Correct answer kglad

    this.Stop();

    should be this.stop();

    ie, case-counts.

    2 replies

    Legend
    March 20, 2018

    When something isn't working, always, always, always check the developer console for error messages.

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    March 20, 2018

    this.Stop();

    should be this.stop();

    ie, case-counts.