在使用 CreateJS 的 Adobe AnimateCC 中,我在第一帧上有一个 mc,在第一帧上有一个disclaimer_btn
mc discTxt
。我希望能够将鼠标悬停disclaimer_btn
和 gotoAndStop 放在discTxt
. 在第 150 帧左右,我尝试将鼠标悬停,但它不起作用。如果我在我的函数中使用警告框,那就可以了。
错误是Uncaught TypeError: Cannot read property 'bind' of undefined
并且在它指向的代码中.bind(this));
如果我在收到错误this.discTxt
之前删除。this.discTxt.fl_MouseOverHandler.bind(this));
Uncaught ReferenceError: fl_MouseOverHandler is not defined
我已经阅读了这篇 SO 帖子,并且在这种情况下,这些解决方案对我不起作用。
我知道这是范围的问题,我在这里做错了什么?
var frequency = 3;
stage.enableMouseOver(frequency);
this.disclaimer_btn.addEventListener("mouseover", this.discTxt.fl_MouseOverHandler.bind(this));
this.fl_MouseOverHandler = function()
{
this.discTxt.gotoAndStop("on");
}