# Function run MouseEvent.CLICK to pass parameters?

**URL:** <https://forum.kirupa.com/t/function-run-mouseevent-click-to-pass-parameters/287873>\
**Category:** flash\
**Created:** [May 7, 2009, 9:56am UTC](https://forum.kirupa.com/t/function-run-mouseevent-click-to-pass-parameters/287873 "2009-05-07T09:56:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThinkKirupa](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@ThinkKirupa](https://forum.kirupa.com/u/ThinkKirupa)\
**Post date:** [May 7, 2009, 9:56am UTC](https://forum.kirupa.com/t/function-run-mouseevent-click-to-pass-parameters/287873/1 "2009-05-07T09:56:08Z")

</div>

Hi.

This will work:

```auto

addVolvo.addEventListener(MouseEvent.CLICK, addCar);

function addCar(evt:MouseEvent)
{
	var car1:Car = new Car( 1, 1, classVolvo)
}

// MouseEvent is automatically passed

```

… but I want to pass the a value when calling the function:

```auto

addVolvo.addEventListener(MouseEvent.CLICK, addCar(classVolvo));

function addCar(evt:MouseEvent, newClass:Class)
{
	var car1:Car = new Car( 1, 1, classVolvo)
}

// I will get this error:
// 1136: Incorrect number of arguments. Expected 2. [addCar(classVolvo)]

```

This won’t work. Because it then just passes the Class and not the MouseEvent. How can I solve this? What should I write in the addCar(…) call function? Ie how to I manually pass an MouseEvent, if that’s what I’m supposed to do?
