# addEventListener not working

**URL:** <https://forum.kirupa.com/t/addeventlistener-not-working/322723>\
**Category:** Uncategorized\
**Created:** [May 31, 2011, 8:34pm UTC](https://forum.kirupa.com/t/addeventlistener-not-working/322723 "2011-05-31T20:34:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SammyTheBear](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@SammyTheBear](https://forum.kirupa.com/u/SammyTheBear)\
**Post date:** [May 31, 2011, 8:34pm UTC](https://forum.kirupa.com/t/addeventlistener-not-working/322723/1 "2011-05-31T20:34:56Z")

</div>

I am having a problem getting this to work. I get this error:

**TypeError: Error #1010: A term is undefined and has no properties.**

It is because of the line of code in bold. It doesn’t like the **this[NavName].** Any suggestions?

for(var i:Number=0; i\<11; i++)  
{  
var num:Number = i;  
var NavName:String = “Nav” + num;  
\*\* this[NavName].addEventListener(MouseEvent.CLICK, runNav);  
\*\*  
function runNav(event:Event):void  
{  
trace(“hello”);  
dispatchEvent(new changeNav(num))  
}  
}

Cheers!
