Multiple event listeners and bind
I posted this question on Stack Overflow, but didn't get an answer, so I'm re-posting here as it has to do with Animate and binding event listeners to functions.
I posted this question on Stack Overflow, but didn't get an answer, so I'm re-posting here as it has to do with Animate and binding event listeners to functions.
Just reviewing the code:
this.c3po.addEventListener("click", choice1.bind(this));
this.r2d2.addEventListener("click", choice2.bind(this));
// Function that moves the timeline. In JS, it starts at 0
function choice1() {
this.gotoAndStop("bantha");
}
function choice2() {
this.gotoAndStop("rocks");
}When clicking on R2, it should go to "rocks", but it goes to "bantha" instead, IF you've already gone to "bantha" and have clicked the Back button. I'm testing in Google Chrome.
Please have a look.
https://drive.google.com/file/d/1okBEybTKwUY65VEewxHP6Ni0IiYWqJmx/view?usp=sharing
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.