简体   繁体   English

Animate CC javascript按钮始终无法正常工作?

[英]Animate CC javascript Buttons not working all the time?

I am making a simple presentation in Animate CC, and I have several buttons, all with different names, similar functions (gotoAndPlay). 我正在Animate CC中做一个简单的演示,我有几个按钮,每个按钮都有不同的名称,相似的功能(gotoAndPlay)。
Only one of the buttons work (button 22), and only on the first click, the second click it goes to the wrong frame? 仅其中一个按钮起作用(按钮22),并且仅在第一次单击时,第二次单击时才转到错误的帧?
I am working on a canvas and exporting as HTML5/Javascript. 我正在画布上并导出为HTML5 / Javascript。

Here is my code 这是我的代码

Button 21 按钮21

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

Button 22 按钮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. 它们都具有“ Up”和“ Over”状态,它们都起作用。 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. 我在adobe论坛中进行了搜索,但似乎没有任何内容。 https://helpx.adobe.com/animate/using/creating-publishing-html5-canvas-document.html http://blogs.adobe.com/animate/category/actionscript/ https://helpx.adobe.com/animate/using/creating-publishing-html5-canvas-document.html http://blogs.adobe.com/animate/category/actionscript/

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)
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM