# Dynamically create addEventListener

**URL:** <https://forum.kirupa.com/t/dynamically-create-addeventlistener/232120>\
**Category:** flash\
**Created:** [July 11, 2007, 11:57am UTC](https://forum.kirupa.com/t/dynamically-create-addeventlistener/232120 "2007-07-11T11:57:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoaoLopes](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@JoaoLopes](https://forum.kirupa.com/u/JoaoLopes)\
**Post date:** [July 11, 2007, 11:57am UTC](https://forum.kirupa.com/t/dynamically-create-addeventlistener/232120/1 "2007-07-11T11:57:55Z")

</div>

I have a problem working on the “addEventListener” class:

I dynamically created some MovieClips and gave them the name of ‘mhandler0’; ‘mhandler1’;… also created others with the name ‘mselect0’; ‘mselect1’;…

The problem is that I don’t know how to create also dynamically those MC’s event listeners.

Can anyone help me please!.. I’m so delayed (my deadline is tomorrow :crying: )

( the code above explains, I think, what I need… )

[FONT=“Courier New”]  
for (var f=0; f\<9; f++) {  
[“mhandler”+f]addEventListener(MouseEvent.CLICK, mhandlerfunction);  
[“mselect”+f]addEventListener(MouseEvent.CLICK, mselectfunction);

}

[/FONT]

Thanks!
