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.
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?
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?