• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Buttons doesn't work

New Here ,
Oct 20, 2019 Oct 20, 2019

Copy link to clipboard

Copied

Good day, can anyone help me please? I have two buttons on different frames:

 

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

function fl_ClickToGoToAndPlayFromFrame_7()
{
this.play();
}

 

 

this.buttontocontinue.addEventListener("click", fl_ClickToGoToAndPlayFromFrame_21.bind(this));

function fl_ClickToGoToAndPlayFromFrame_21()
{
this.play();
}

 

The first button's function works fine, but the second button's function behaves as the first button, it takes me back to the frame of the first button then plays, instead of continuing to play at the current frame. I'm doing this on an html5 canvas. Sorry if this is just a dumb mistake that anyone can point out too. Any help would be very much appreciated.

Views

91

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 21, 2019 Oct 21, 2019

Copy link to clipboard

Copied

LATEST

Check the console in the browser, are you getting any errors?

Based on the code you've provided, the results you're describing are very odd. You're just using this.play(); in both functions, which shouldn't cause you to jump anywhere on the timeline, it should just keep playing from whatever frame it's currently on. Based on your function names, it seems to me like what you want is this.gotoAndPlay(6); and this.gotoAndPlay(20); (you have to remember the Animate interface starts at frame 1, but on export createJS starts at frame 0)

 

Is all of your code on the same frame? I was able to recreate the effect you're describing if I put both functions on frame 1, but added the event listener for the second button on frame 21. Keep in mind you can't call functions that exist on a different frame unless you make them a global variable like this:

fl_ClickToGoToAndPlayFromFrame_21 = function()
{
this.play();
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines