# Why this is not working? Buttons!

**URL:** <https://forum.kirupa.com/t/why-this-is-not-working-buttons/285217>\
**Category:** flash\
**Created:** [March 28, 2009, 7:26pm UTC](https://forum.kirupa.com/t/why-this-is-not-working-buttons/285217 "2009-03-28T19:26:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruiganga](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ruiganga/32/3679_2.png) [@ruiganga](https://forum.kirupa.com/u/ruiganga)\
**Post date:** [March 28, 2009, 7:26pm UTC](https://forum.kirupa.com/t/why-this-is-not-working-buttons/285217/1 "2009-03-28T19:26:34Z")

</div>

Hi

I am trying to make a function that can be used for every button that hange pages. My code is:

function changePage (e:MouseEvent, selectedPage:Number){  
trace("The Selected Page is: "+selectedPage)  
}

button1.addEventListener(MouseEvent.CLICK, changePage, 1);

button2.addEventListener(MouseEvent.CLICK, changePage, 2);

Why this is not working?

Thanks 🙂
