# How to dynamically generate buttons in AS3?

**URL:** <https://forum.kirupa.com/t/how-to-dynamically-generate-buttons-in-as3/234400>\
**Category:** flash\
**Created:** [August 1, 2007, 9:52pm UTC](https://forum.kirupa.com/t/how-to-dynamically-generate-buttons-in-as3/234400 "2007-08-01T21:52:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iceflyin](https://avatars.discourse-cdn.com/v4/letter/i/9de053/32.png) [@iceflyin](https://forum.kirupa.com/u/iceflyin)\
**Post date:** [August 1, 2007, 9:52pm UTC](https://forum.kirupa.com/t/how-to-dynamically-generate-buttons-in-as3/234400/1 "2007-08-01T21:52:11Z")

</div>

I just need to be steered in the right direction. In AS3-CS3, we can’t apply code to objects anymore, right?

My old method for creating buttons off an original was to create an instance in the library and set it for export. Then I would duplicate it onto the stage at runtime, dynamically setting each button’s action and text at that time.

Now in AS3, What do I do? Create a class that can be applied to buttons or something?

Dunno the best way to do it now. I’m thinking of creating a listener that listens to all my buttons I create at runtime, and does an action based upon the instance of the button pressed. :look:
