# Problem w/ attaching MC in for loop

**URL:** <https://forum.kirupa.com/t/problem-w-attaching-mc-in-for-loop/257779>\
**Category:** flash\
**Created:** [April 17, 2008, 12:57am UTC](https://forum.kirupa.com/t/problem-w-attaching-mc-in-for-loop/257779 "2008-04-17T00:57:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![munit5000](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@munit5000](https://forum.kirupa.com/u/munit5000)\
**Post date:** [April 17, 2008, 12:57am UTC](https://forum.kirupa.com/t/problem-w-attaching-mc-in-for-loop/257779/1 "2008-04-17T00:57:17Z")

</div>

(Flash 8)  
Hi, this isn’t causing any adverse effects in my code, but is still confusing for me:

(this is the onClipEvent(Load) in the MC AsteroidsLoop)

```auto
for(i = 0; i < 1; i++) {
      _root.AsteroidsLoop.attachMovie("Asteroid", "Asteroid"+ i, 50000+i, {xPos:_root._width*Math.random(), yPos:_root._height*Math.random()});
}

for(i in _root.AsteroidsLoop) {
      trace(_root.AsteroidsLoop* + " " + i);
}

```

which traces:

```auto
1 i
_level0.AsteroidsLoop.Asteroid0 Asteroid0

```

And i don’t know what the “1 i” means or what movie clip it is.

All i am trying to do is get the first movieClip in AsteroidsLoop without knowing it’s instance name.  
Also, i wish i could use \_root.getNextHighestDepth() in place of 50000 + i, but i find that getNextHighestDepth() does not work consistently for me (in the case of the for loop it always returns 1).
