# Cannot control mcs created by a loop

**URL:** https://forum.kirupa.com/t/cannot-control-mcs-created-by-a-loop/295125
**Category:** Uncategorized
**Created:** [August 25, 2009, 6:18pm UTC](https://forum.kirupa.com/t/cannot-control-mcs-created-by-a-loop/295125 "2009-08-25T18:18:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![OMG](https://avatars.discourse-cdn.com/v4/letter/o/9dc877/32.png) [@OMG](https://forum.kirupa.com/u/OMG)
#### Post date: [August 25, 2009, 6:18pm UTC](https://forum.kirupa.com/t/cannot-control-mcs-created-by-a-loop/295125/1 "2009-08-25T18:18:26Z")

</div>

simplied version:  
(there’s a mc of the Box class in the library)

```auto

for (var i:int=0; i<10; i++) {
 var box:Box=new Box();
 box.x=Math.random()*stage.stageWidth;
 box.y=Math.random()*stage.stageHeight;
 stage.addChild(box);
 box.name="box"+i;
}
box2.x=100;

```

error: access of undefined property box2
