Skip to main content
Inspiring
June 11, 2017
Answered

HTML5-Canvas gtoAndPlay not working

  • June 11, 2017
  • 1 reply
  • 325 views

Hi All,

I have two buttons on the stage. Instance names = "btn_begin" and "btn_touch" btn_begin works fine but I can't get the second one to work at all.

Frame name "gobabygo" is frame 1, and frame 200 also has a name "touchscreen1" I have tried both the name and number.

Here is my code,  it's sitting on frame 140.

======

this.stop();

this.btn_begin.addEventListener("click", fl_ClickToGoToAndPlayFromFrame_7.bind(this));

function fl_ClickToGoToAndPlayFromFrame_7()

{

    this.gotoAndPlay("gobabygo");

}

this.btn_touch.addEventListener("click", fl_ClickToGoToAndPlayFromFrame_8.bind(this));

function fl_ClickToGoToAndPlayFromFrame_8()

{

    this.gotoAndPlay(200);

}

======

Thanks! Any help is appreciated.

    This topic has been closed for replies.
    Correct answer marjantrajkovski

    That code is ok. Here is working example with your code https://ufile.io/6g9eb , check instance name of your btn_touch button.

    1 reply

    marjantrajkovskiCorrect answer
    Inspiring
    June 11, 2017

    That code is ok. Here is working example with your code https://ufile.io/6g9eb , check instance name of your btn_touch button.

    Inspiring
    June 11, 2017

    Thanks Marjam,

    Yes. You were right. There was two instance names for the button. One name before the tween and another after the tween.

    Thanks!

    Dan