Copy link to clipboard
Copied
Hi!
I'm kind of new to Animate and I'm struggling to do something that I imagine is very simple for you. I have a list of 4 buttons that when I click it was to open a different text for each button, but when I click on a button it goes to the frame and doesn't open anything else. It gets "stuck" on that frame and the other buttons don't work. Help...
Oh! I'm using a HTML5 canvas.
Copy link to clipboard
Copied
Here is one solution. Put the message for each button in a separate layer that displays when the timeline goes to a designated frame (identified with a label). Create an on click event listener for each button that calls a function to advance to the labeled frame. The code is in frame 1 of a layer named Actions and reads:
this.stop();
this.button1.addEventListener("click", fl_ClickToGoToAndStopAtFrame.bind(this, "Page1"));
this.button2.addEventListener("click", fl_ClickToGoToAndStopAtFrame.bind(this, "Page2"));
this.button3.addEventListener("click", fl_ClickToGoToAndStopAtFrame.bind(this, "Page3"));
this.button4.addEventListener("click", fl_ClickToGoToAndStopAtFrame.bind(this, "Page4"));
function fl_ClickToGoToAndStopAtFrame(t){
this.gotoAndStop(t);
}