Skip to main content
Participant
May 15, 2018
Answered

Can you set variables to buttons to control the timeline

  • May 15, 2018
  • 1 reply
  • 448 views

Hi All

It has been a very long time since I have developed in Flash... now Animate.

I am working my way around the new software but have a question...

I was wondering if I can add a variable to a button to control the timeline.

What I want to do is have, say, 4 buttons on a frame... then when one of the buttons is selected it goes to the next frame for general info and then it moves to one of 4 other frames.

What I am thinking is something like:

  • Frame 1 - 4 buttons
    • Button 1 - linked to frame 2 to redirect to frame 3
    • Button 2 - linked to frame 2 to redirect to frame 4
    • Button 3 - linked to frame 2 to redirect to frame 5
    • Button 4 - linked to frame 2 to redirect to frame 6
  • Frame 2 - general information that shows for a while and then skips to the correct frame depending on the button that was selected.

Is this possible?

If so can you help me with the code I need or point me in the right direction for a tutorial etc.

Thanks for your help in advance.

This topic has been closed for replies.
Correct answer JoãoCésar17023019

Hi.

It is.

Basically:

- You store the final frame you want to go in a variable when the user clicks on one of the buttons;

- Set a timeout on the second frame to hold the amount of time you want;

- Then, after the timeout, you send the timeline to the final frame.

As I don't know which type of document you are working on, I created two similar examples in AS3 and JavaScript. Notice that I'm using the buttons names to get the final frames.

FLA download (HTML5 (Canvas)):

animate_cc_html5_button_navigation.zip - Google Drive

FLA download (AS3):

animate_cc_as3_button_navigation.zip - Google Drive

I hope it helps.

Regards,

JC

1 reply

JoãoCésar17023019
Community Expert
JoãoCésar17023019Community ExpertCorrect answer
Community Expert
May 15, 2018

Hi.

It is.

Basically:

- You store the final frame you want to go in a variable when the user clicks on one of the buttons;

- Set a timeout on the second frame to hold the amount of time you want;

- Then, after the timeout, you send the timeline to the final frame.

As I don't know which type of document you are working on, I created two similar examples in AS3 and JavaScript. Notice that I'm using the buttons names to get the final frames.

FLA download (HTML5 (Canvas)):

animate_cc_html5_button_navigation.zip - Google Drive

FLA download (AS3):

animate_cc_as3_button_navigation.zip - Google Drive

I hope it helps.

Regards,

JC

Participant
May 16, 2018

Thank you so much... from your example I should be able to work it out.