# TypeError: Error #1010: and MovieClips

**URL:** <https://forum.kirupa.com/t/typeerror-error-1010-and-movieclips/323364>\
**Category:** flash\
**Created:** [June 27, 2011, 6:03pm UTC](https://forum.kirupa.com/t/typeerror-error-1010-and-movieclips/323364 "2011-06-27T18:03:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stumped](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@stumped](https://forum.kirupa.com/u/stumped)\
**Post date:** [June 27, 2011, 6:03pm UTC](https://forum.kirupa.com/t/typeerror-error-1010-and-movieclips/323364/1 "2011-06-27T18:03:11Z")

</div>

I am working with pictures. I want someone to pick one of three. The pictures will be held in movieclips.

var container0:MovieClip = new MovieClip();  
var container1:MovieClip = new MovieClip();  
var container2:MovieClip = new MovieClip();

Intially they have an alpha of 0. I want them to all of appear at once. I use the following code to make them appear. This code does not have a problem. It works.

for (var b:int = 0; b \< 3; b++) {  
this[“container”+b].alpha = 1;  
}

I then need to add an event listener to listen for the mouse click. I want to use a loop.

for (var b:int = 0; b \< 3; b++) {  
this[“container”+b].addEventListener(MouseEvent.CLICK, evaluation);  
}

But when I do it this way I get the following error.  
TypeError: Error #1010: A term is undefined and has no properties.  
at MethodInfo-6()  
The code: var container0:MovieClip = new MovieClip(); is at line 6.

If I use the following code all works well.

container0.addEventListener(MouseEvent.CLICK, evaluation);  
container1.addEventListener(MouseEvent.CLICK, evaluation);  
container2.addEventListener(MouseEvent.CLICK, evaluation);

I know the simple answer is to use the code that works but I would like to do it with a loop because I want to vary the number of pictures.

Any help is greatly appreciated. Thanks … Michael
