Cannot control mcs created by a loop

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


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