# Passing Arguments through Event Handlers

**URL:** <https://forum.kirupa.com/t/passing-arguments-through-event-handlers/261920>\
**Category:** flash\
**Created:** [June 1, 2008, 8:16pm UTC](https://forum.kirupa.com/t/passing-arguments-through-event-handlers/261920 "2008-06-01T20:16:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![le\_architect](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/le_architect/32/3934_2.png) [@le\_architect](https://forum.kirupa.com/u/le_architect)\
**Post date:** [June 1, 2008, 8:16pm UTC](https://forum.kirupa.com/t/passing-arguments-through-event-handlers/261920/1 "2008-06-01T20:16:51Z")

</div>

Hi,

I am having trouble passing an additional value through the addEventListener method. Can someone tell me how to pass in values so my function knows what buttons were pressed?

a.addEventListener(MouseEvent.MOUSE\_UP, jumpThumb(“mouseUp”, 0));  
b.addEventListener(MouseEvent.MOUSE\_UP, jumpThumb(“mouseUp”, 1));  
c.addEventListener(MouseEvent.MOUSE\_UP, jumpThumb(“mouseUp”, 2));

function jumpThumb(event:MouseEvent, mouseButton:int):void {  
//statement that uses value of mouseButton  
}

Thanks for any help!

Bobby

---

<div class="post-metadata">

**Author:** ![dail](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@dail](https://forum.kirupa.com/u/dail)\
**Post date:** [June 1, 2008, 10:34pm UTC](https://forum.kirupa.com/t/passing-arguments-through-event-handlers/261920/2 "2008-06-01T22:34:42Z")

</div>

event.target will tell you what button was pressed…

---

<div class="post-metadata">

**Author:** ![dail](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@dail](https://forum.kirupa.com/u/dail)\
**Post date:** [June 1, 2008, 11:57pm UTC](https://forum.kirupa.com/t/passing-arguments-through-event-handlers/261920/3 "2008-06-01T23:57:31Z")

</div>

or,  
[http://blog.onebyonedesign.com/?p=60](http://blog.onebyonedesign.com/?p=60)

A good post outlining some approaches

---

<div class="post-metadata">

**Author:** ![le\_architect](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/le_architect/32/3934_2.png) [@le\_architect](https://forum.kirupa.com/u/le_architect)\
**Post date:** [June 2, 2008, 12:46am UTC](https://forum.kirupa.com/t/passing-arguments-through-event-handlers/261920/4 "2008-06-02T00:46:10Z")

</div>

Dale,

Thanks for the posts. They are very helpful 🙂

Bobby
