# Function for buttons

**URL:** https://forum.kirupa.com/t/function-for-buttons/212920
**Category:** Uncategorized
**Created:** [January 15, 2007, 7:24pm UTC](https://forum.kirupa.com/t/function-for-buttons/212920 "2007-01-15T19:24:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![qpixo](https://avatars.discourse-cdn.com/v4/letter/q/c4cdca/32.png) [@qpixo](https://forum.kirupa.com/u/qpixo)
#### Post date: [January 15, 2007, 7:24pm UTC](https://forum.kirupa.com/t/function-for-buttons/212920/1 "2007-01-15T19:24:18Z")

</div>

Is there a better way to write those code more clean?  
Let’s say I have several buttons and I want to write a nice function to manage them like that:

For example instead of using:

tab\_option1.onRollOut = function() {  
gotoAndPlay(‘transition’);  
};

tab\_option1.onRollOver = function() {  
gotoAndPlay(‘debut’);

};

tab\_option1.onRelease = function() {  
getURL("…","…");  
};

How about put them in an array and write a function to manage them instead to rewrite those code again…

Any examples?
