# Pass parameters to the eventhandler

**URL:** <https://forum.kirupa.com/t/pass-parameters-to-the-eventhandler/291956>\
**Category:** flash\
**Created:** [July 8, 2009, 9:11am UTC](https://forum.kirupa.com/t/pass-parameters-to-the-eventhandler/291956 "2009-07-08T09:11:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noahdecoco](https://avatars.discourse-cdn.com/v4/letter/n/5fc32e/32.png) [@Noahdecoco](https://forum.kirupa.com/u/Noahdecoco)\
**Post date:** [July 8, 2009, 9:11am UTC](https://forum.kirupa.com/t/pass-parameters-to-the-eventhandler/291956/1 "2009-07-08T09:11:16Z")

</div>

Hey again Kirupians,

Is there any way to shorten this code by passing parameters to the eventhandler through the addeventlistener?

For example, this is the code:

```auto

upBtn.addEventListener(MouseEvent.MOUSE_UP, goUp)
downBtn.addEventListener(MouseEvent.MOUSE_UP, goDown)

function goUp(e:MouseEvent):void{
     makeChange("up")
}

function goDown(e:MouseEvent):void{
     makeChange("down")
}

function makeChange(msg):void{
     trace (msg)// up if up pressed, down if down pressed
}

```

Is there some sort of way to do:

```auto

upBtn.addEventListener(MouseEvent.MOUSE_UP, makeChange(up))
downBtn.addEventListener(MouseEvent.MOUSE_UP, makeChange(down))

function makeChange(msg):void{
     trace (msg)// up if up pressed, down if down pressed
}

```

Basically, just pass the params to the handler through the listener… I hope there is, this is getting tedious…

Cheers!
