# Problem adding addEventListener

**URL:** https://forum.kirupa.com/t/problem-adding-addeventlistener/301222
**Category:** flash
**Created:** [December 5, 2009, 12:28pm UTC](https://forum.kirupa.com/t/problem-adding-addeventlistener/301222 "2009-12-05T12:28:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![excogitator](https://avatars.discourse-cdn.com/v4/letter/e/d26b3c/32.png) [@excogitator](https://forum.kirupa.com/u/excogitator)
#### Post date: [December 5, 2009, 12:28pm UTC](https://forum.kirupa.com/t/problem-adding-addeventlistener/301222/1 "2009-12-05T12:28:13Z")

</div>

Hi Everyone,  
Im facing this small problem for which I haven’t been able to figure a solution. It would be of great help to know how to get it working.

I have a series of named and numbered movieclips on stage that require the same function to be called.

The following code works

```auto

ace1.addEventListener(MouseEvent.CLICK, goPage); 
function goPage(event:MouseEvent)
{
    trace("test");
}

```

But the following code gives the error  
1120: Access of undefined property ace

```auto

var i =new Number(1);
ace*.addEventListener(MouseEvent.CLICK, goPage); 
function goPage(event:MouseEvent)
{
    trace("test");
}

```

Again in another example if I have another movieclip within ace1 and I try to assign the code to it as below. This works

```auto

var i =new Number(1);
ace1.base1.addEventListener(MouseEvent.CLICK, goPage); 
function goPage(event:MouseEvent)
{
    trace("test");
}

```

But if I try similar approach.  
I get the error 1010: A term is undefined and has no properties

```auto

var i =new Number(1);
ace1.base*.addEventListener(MouseEvent.CLICK, goPage); 
function goPage(event:MouseEvent)
{
    trace("test");
}

```

Any suggestions and corrections are appreciated.  
Thank you.
