• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

4 buttons and 4 different texts

New Here ,
Mar 04, 2020 Mar 04, 2020

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.

TOPICS
ActionScript , Code , How to , Other

Views

233

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 07, 2020 Mar 07, 2020

Copy link to clipboard

Copied

LATEST

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);
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines