# Undefined depth in attached movie

**URL:** https://forum.kirupa.com/t/undefined-depth-in-attached-movie/271282
**Category:** Uncategorized
**Created:** [September 20, 2008, 8:51pm UTC](https://forum.kirupa.com/t/undefined-depth-in-attached-movie/271282 "2008-09-20T20:51:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![andrewrench](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@andrewrench](https://forum.kirupa.com/u/andrewrench)
#### Post date: [September 20, 2008, 8:51pm UTC](https://forum.kirupa.com/t/undefined-depth-in-attached-movie/271282/1 "2008-09-20T20:51:35Z")

</div>

I’ve been running into a funny issue with my custom AS2 class. Basically I can’t seem to do anything depth-related with my instances placed with attachMovie.

The code below is just a small excerpt. The trace statement comes up ‘undefined’. The funny thing is that the instance does exist because I can successfully trace the clip if I remove the “.getDepth()” from the trace statement.

Any ideas?

```auto

for (var i:Number = 0; i < items; i++) { 
	targetMC = parent_mc.attachMovie("panel"+i, "panel"+i, i);
	trace(targetMC.getDepth());
}

```
