Undefined depth in attached movie

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?


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