# Multiple buttons with similar actions

**URL:** <https://forum.kirupa.com/t/multiple-buttons-with-similar-actions/181973>\
**Category:** Uncategorized\
**Created:** [March 14, 2006, 5:43pm UTC](https://forum.kirupa.com/t/multiple-buttons-with-similar-actions/181973 "2006-03-14T17:43:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ric373](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@Ric373](https://forum.kirupa.com/u/Ric373)\
**Post date:** [March 14, 2006, 5:43pm UTC](https://forum.kirupa.com/t/multiple-buttons-with-similar-actions/181973/1 "2006-03-14T17:43:58Z")

</div>

hi everyone,

i have a problem with buttons in Flash. I have about 20 buttons on the stage and i want them all to have nearly the same AS.  
Example:

button1:  
on (release){  
select = **1** ;  
gotoAndStop(1);  
}

button2:  
on (release){  
select = **2** ;  
gotoAndStop(1);  
}

Is there a way of changing this into 1 piece of code on the timeline, something like:

\_root[“button”+ **a**].onRelease=function(){  
select = **a** ;  
gotoAndStop(1);  
}

I hope this can be done, so i won’t have to update 20 buttons if something changes.

Thanks.

---

<div class="post-metadata">

**Author:** ![Bokke](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Bokke](https://forum.kirupa.com/u/Bokke)\
**Post date:** [March 18, 2006, 10:53pm UTC](https://forum.kirupa.com/t/multiple-buttons-with-similar-actions/181973/2 "2006-03-18T22:53:26Z")

</div>

```auto
me.thankYou();

```

[FONT=Courier New][/FONT]
