Problemo

Hi, I’m trying to use a loop to add some movie clips to the stage, but I want to give each one a different name so I can refer to them in another function, but I don’t know how that is done. I’m trying to learn how to do this so I can create an Isometric game. Here’s my code…

private function buildFloor(){

var y = 0;
var x = 0;
var z = 0;
tiles = [];
for(var row:Number = 0;row <=4; row++){
for (var col = 0; col <=4; col++){

x = row * 142;
z = -col * 142;

temp = mapToScreen(x,y,z);

groundTile = new Tile;
groundTile.name = “cell”+row+"_"+col;
groundTile.x = temp[0]+200.8;
groundTile.y = temp[1];
addChild(groundTile);---------> here’s where I add the movie clip to the stage.
}
}

}

private function arrange(ob1, ob2, ob3):void {-------------->I want to put the mc’s I added to the stage in this function so I can sort their depths.
var sortedItems:Array = new Array(ob1, ob2, ob3);

sortedItems.sortOn(“y”, Array.NUMERIC);
var i:int = sortedItems.length;
while(i–){
if (getChildIndex(sortedItems*) != i) {
setChildIndex(sortedItems*, i);
}
}
}

Thanks for your help…