Why this is not working? Buttons!

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 :slight_smile: