2 Replies Latest reply on May 8, 2017 1:36 PM by robdillon

    How do I code a button on the stage?

    BNF_GraphicDesign

      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!

        • 1. Re: How do I code a button on the stage?
          kglad Adobe Community Professional & MVP

          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?

          1 person found this helpful
          • 2. Re: How do I code a button on the stage?
            robdillon Most Valuable Participant

            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?

            2 people found this helpful