# Retrieving names of objects stored in an array

**URL:** <https://forum.kirupa.com/t/retrieving-names-of-objects-stored-in-an-array/86518>\
**Category:** flash\
**Created:** [April 13, 2005, 3:33pm UTC](https://forum.kirupa.com/t/retrieving-names-of-objects-stored-in-an-array/86518 "2005-04-13T15:33:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PainBehindMyEye](https://avatars.discourse-cdn.com/v4/letter/p/eada6e/32.png) [@PainBehindMyEye](https://forum.kirupa.com/u/PainBehindMyEye)\
**Post date:** [April 13, 2005, 3:33pm UTC](https://forum.kirupa.com/t/retrieving-names-of-objects-stored-in-an-array/86518/1 "2005-04-13T15:33:59Z")

</div>

I have an array (thanks to “stringy” on this forum!) of objects. The objects instances of movie clips that were attached to a container mc and then a loop was used to sort through the objects contained in container. This loop checks to see if the type of object is a movieclip. I’m trying to retrieve the name of each movieclip that is stored in the array as objects. How do I do this? Presently I’m getting [object object] rather than the name.

I’m thinking this is pretty straightforward and that there’s something small I’m missing here.  
Here’s the loop:

```auto

function createarray() {
	newarray = [];
	for (var obj in container) {
		if (typeof container[obj] == "movieclip") {
			myNameIs = container[obj].name; //<- obviously no good but...
/ ****how do I get the name of obj in container?***** /
			trace(container[obj].toString()); // <- gives me array numbers
			newarray.push(container[obj]);
		}
	}
	//trace(newarray.toString());
}

```

Rather than bug Stringy privately, I figured other people must have this question/problem as well. It seems to be a common thing.

Thanks to anyone kind enough to help out.
