# Apply a function to multiple buttons

**URL:** <https://forum.kirupa.com/t/apply-a-function-to-multiple-buttons/275850>\
**Category:** flash\
**Created:** [November 19, 2008, 12:35pm UTC](https://forum.kirupa.com/t/apply-a-function-to-multiple-buttons/275850 "2008-11-19T12:35:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![retribution](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@retribution](https://forum.kirupa.com/u/retribution)\
**Post date:** [November 19, 2008, 12:35pm UTC](https://forum.kirupa.com/t/apply-a-function-to-multiple-buttons/275850/1 "2008-11-19T12:35:44Z")

</div>

Hi, this is a REAL basic one for you:

This is my script:

count = 0;

btn\_01.onRelease = function() {  
if (count\<=20 && this.\_currentframe == 1) {  
\_root.count += 1;  
this.gotoAndStop(2);  
trace(count);

```
} else {
    if (this._currentframe == 2) {
    _root.count -= 1;
    this.gotoAndStop(1);
    trace(count);

}
}

```

};  
Instead of applying it to just one button I want to apply it to many on the stage, how do i add the names of the buttons to the function? I tried separating with commas but no luck 😉
