1

I am making a simple presentation in Animate CC, and I have several buttons, all with different names, similar functions (gotoAndPlay).
Only one of the buttons work (button 22), and only on the first click, the second click it goes to the wrong frame?
I am working on a canvas and exporting as HTML5/Javascript.

Here is my code

Button 21

this.Site21.addEventListener("click",fl_ClickToGoToAndPlayFromFrame_22.bind(this));
function fl_ClickToGoToAndPlayFromFrame_22()
 {
  this.gotoAndPlay(22);
 }

Button 22

this.Site22.addEventListener("click", fl_ClickToGoToAndPlayFromFrame_23.bind(this));

function fl_ClickToGoToAndPlayFromFrame_23()
{
  this.gotoAndPlay(23);
}

They all have 'Up' and 'Over' states, which all work. Just the actions seem not to work.

I have checked the console when I upload it, and there's no errors.

I have searched through the adobe forum, but there doesn't seem to be anything on this. https://helpx.adobe.com/animate/using/creating-publishing-html5-canvas-document.html http://blogs.adobe.com/animate/category/actionscript/

Marty
  • 39,033
  • 19
  • 93
  • 162
Fushy
  • 83
  • 2
  • 13

1 Answers1

2
var jsObject = this;
this.Site21.addEventListener("click", fl_ClickToGoToAndPlayFromFrame_22(e));
function fl_ClickToGoToAndPlayFromFrame_22(e)
{
  // if you need access to main
  jsObject.gotoAndPlay(22);
  // because here "this" means this current button
  // e – means event (click)
}
Vladimir
  • 214
  • 2
  • 12