# as3 Get Movieclip name from array

**URL:** <https://forum.kirupa.com/t/as3-get-movieclip-name-from-array/329354>\
**Category:** flash\
**Created:** [August 16, 2012, 11:28pm UTC](https://forum.kirupa.com/t/as3-get-movieclip-name-from-array/329354 "2012-08-16T23:28:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rewrew333](https://avatars.discourse-cdn.com/v4/letter/r/ebca7d/32.png) [@rewrew333](https://forum.kirupa.com/u/rewrew333)\
**Post date:** [August 16, 2012, 11:28pm UTC](https://forum.kirupa.com/t/as3-get-movieclip-name-from-array/329354/1 "2012-08-16T23:28:42Z")

</div>

How do you get the name of a movieclip that is cycling through an array?

```auto
var wallList:Array = new Array(wall1, wall2, wall3, wall4);
for (var i:int=0; i<wallList.length; i++) { 
        if (wallList*.hitTestObject(ME)){
                  lastWall = wallList*;
                  trace(lastWall);
        }
}

```

In the case above I have “wall1,wall2,wall3,wall4” in an array and if ME is hitting one of the walls the name should be stored in lastWall.

The hitest works, I do get to trace but then lastWall (which is a string) is [MovieClip]  
So what needs to be done to get the name “wall1”.

Thanks
