Copy link to clipboard
Copied
Hi All,
Wondering what I'm doing wrong. Why doesn't this work in my Animate CC, HTML5 project? (probably something obvious)
stage.btn1_INS.addEventListener("click", buttonClick.bind(this));
function buttonClick() {
alert("I am active");
}
btn1_INS is a Symbol with a type of Button.
Thanks
The top level of the timeline need not be the same thing as 'stage', I think mainly because of the new camera features. You would normally say:
this.btn1_INS.addEventListener("click", buttonClick.bind(this));
function buttonClick() {
alert("I am active");
}
Copy link to clipboard
Copied
The top level of the timeline need not be the same thing as 'stage', I think mainly because of the new camera features. You would normally say:
this.btn1_INS.addEventListener("click", buttonClick.bind(this));
function buttonClick() {
alert("I am active");
}
Copy link to clipboard
Copied
Must be something else. That doesn't work either... But if I put the listener on the header image (that is a Movie Clip) it works.
this.header_INS.addEventListener("click", buttonClick.bind(this)); //This works
this.btn1_INS.addEventListener("click", buttonClick.bind(this)); //This doesn't
function buttonClick() {
alert("I am active");
}
Copy link to clipboard
Copied
Check whether the btn1_INS has had that name since the start of the timeline. If you have key frames and you have the symbol named after the keyframe but not before, then it will fail.
Also, if btn1_INS is in fact a Button, and header_INS is a movieclip, check the Hit frame inside the button has something there.
Copy link to clipboard
Copied
Sorry Colin: User error.
The problem was my fundamental lack of understanding about buttons from the Component window.
Thanks
Find more inspiration, events, and resources on the new Adobe Community
Explore Now