# Extending events, passing parameters to event handlers and controlling MCs

**URL:** <https://forum.kirupa.com/t/extending-events-passing-parameters-to-event-handlers-and-controlling-mcs/245349>\
**Category:** flash\
**Created:** [November 28, 2007, 7:59pm UTC](https://forum.kirupa.com/t/extending-events-passing-parameters-to-event-handlers-and-controlling-mcs/245349 "2007-11-28T19:59:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iblokh](https://avatars.discourse-cdn.com/v4/letter/i/8baadc/32.png) [@iblokh](https://forum.kirupa.com/u/iblokh)\
**Post date:** [November 28, 2007, 7:59pm UTC](https://forum.kirupa.com/t/extending-events-passing-parameters-to-event-handlers-and-controlling-mcs/245349/1 "2007-11-28T19:59:51Z")

</div>

Ok, I assume this issue has been covered to death, but I’m still lost. In my application, I have numerous buttons which, when clicked, will activate numerous movie clips. To avoid having to create individual event ahndler functiosn for each button, I would like to be able to pass parameters to the event handler so it knows which movie clip to activate.

In other words, here’s what I’d like to do:

```auto

for (i=0; i<spirals.length; i++) {
    spirals*.spiral.addEventListener(MouseEvent.CLICK, spiralUnroll);
        spirals*.text.addEventListener(MouseEvent.CLICK, spiralUnroll(spirals*.spiral));
}

```

spirals[] is an array I built, filled with a custom class Spiral, which contains, amongst other attributes, an MC called spiral and an MC called text. When clicked, either one should activate the spiral MC’s animation.

Now, I know the above syntax is incorrect and that I need to create my own event to do this - but all the examples I’ve seen show that I later have to dispatch the event myself. I, however, need the event to be dispatched on mouse click. Any ideas?
