# AS3 Button.EventListeners

**URL:** <https://forum.kirupa.com/t/as3-button-eventlisteners/298250>\
**Category:** flash\
**Created:** [October 15, 2009, 2:22pm UTC](https://forum.kirupa.com/t/as3-button-eventlisteners/298250 "2009-10-15T14:22:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitroplonker](https://avatars.discourse-cdn.com/v4/letter/n/3da27b/32.png) [@nitroplonker](https://forum.kirupa.com/u/nitroplonker)\
**Post date:** [October 15, 2009, 2:22pm UTC](https://forum.kirupa.com/t/as3-button-eventlisteners/298250/1 "2009-10-15T14:22:34Z")

</div>

Hi,

I have a rookie question to ask and it’s how to assign the same event listeners to multiple buttons in as3 instead of having to write out the same code over and over again like so…

```
 ActionScript Code:
 [LEFT]listing.[COLOR=#000080]home[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]ROLL_OVER[/COLOR] , butOver[COLOR=#000000])[/COLOR]
    listing.[COLOR=#000080]home[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]ROLL_OUT[/COLOR] , butOut[COLOR=#000000])[/COLOR]
    listing.[COLOR=#000080]home[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR] , released[COLOR=#000000])[/COLOR]
    listing.[COLOR=#000080]home[/COLOR].[COLOR=#0000ff]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR];
    listing.[COLOR=#000080]draw[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]ROLL_OVER[/COLOR] , butOver[COLOR=#000000])[/COLOR]
    listing.[COLOR=#000080]draw[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]ROLL_OUT[/COLOR] , butOut[COLOR=#000000])[/COLOR]
    listing.[COLOR=#000080]draw[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR] , released[COLOR=#000000])[/COLOR]
    listing.[COLOR=#000080]draw[/COLOR].[COLOR=#0000ff]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR];
    listing.[COLOR=#000080]away[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]ROLL_OVER[/COLOR] , butOver[COLOR=#000000])[/COLOR]
    listing.[COLOR=#000080]away[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]ROLL_OUT[/COLOR] , butOut[COLOR=#000000])[/COLOR]
    listing.[COLOR=#000080]away[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR] , released[COLOR=#000000])[/COLOR]
    listing.[COLOR=#000080]away[/COLOR].[COLOR=#0000ff]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR];

```

[/LEFT]

and so on

cheers

Steve
