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

How do I code a button on the stage?

New Here ,
May 08, 2017 May 08, 2017

Copy link to clipboard

Copied

I'm trying to code a button on the timeline and not within the button itself so I can use the same button to trigger different things on the timeline. But I can't figure out how to code the button on the timeline, I can only seem to do it within the button itself, which makes it kind of useless to me. Does anyone know how to do this or where I can go to find out? Even a list of code snippets would help.

Let me know if I can provide any more information that would make it easier to help.

Thanks!

Views

219

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

correct answers 1 Correct answer

Community Expert , May 08, 2017 May 08, 2017

assign the button an instance name (in the properties panel) and use that name to add an event listener to the button.

if you need more help than that, as3 or html5/canvas?

Votes

Translate

Translate
Community Expert ,
May 08, 2017 May 08, 2017

Copy link to clipboard

Copied

assign the button an instance name (in the properties panel) and use that name to add an event listener to the button.

if you need more help than that, as3 or html5/canvas?

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
LEGEND ,
May 08, 2017 May 08, 2017

Copy link to clipboard

Copied

LATEST

In both Actionscript and HTML5 canvas you give your button an instance name. Then you can add an event listener to that named object. The event listener links a function to the event. This means that the event, like clicking on the button object, will cause a function to be executed. To get a single button to execute more than one function you will need to remove one event listener and attach a different event listener. Does that help?

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