In Adobe AnimateCC using CreateJS I have an mc on frame one called disclaimer_btn
, and an mc on frame one called discTxt
. I want to be able to mouseover disclaimer_btn
and gotoAndStop on a frame label in discTxt
. Round about frame 150 I try to do the mouseover and it's not working. If I use an alert box in my function, that works.
The error is Uncaught TypeError: Cannot read property 'bind' of undefined
and in the code it points to here .bind(this));
If I remove this.discTxt
from before this.discTxt.fl_MouseOverHandler.bind(this));
I get the error Uncaught ReferenceError: fl_MouseOverHandler is not defined
.
I have read this SO post and this one and those solutions are not working for me in this case.
I get this is a problem of scope, what am I doing wrong here?
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");
}