hola , setChilIndex(children,index) recibe como parametro el hijo y su indice, y getChildByName("nombre del hijo"), y tu a getChildByName() le pasas un array con elementos MovieClip algo sin poco sentido, al menos que pusieras
getChildByName(objects[i].name),pero teniendo ya un array de objetos "children", no es necesario el uso de getChildByName(),el codigo seria asi:
Código ActionScript :
var objects:Array = new Array(object0,object1,object2);
for(var i:uint = 0; i<objects.length; i++) {
trace(objects[i].name + " se encuentra en el index " + this.getChildIndex(objects[i]));
}
for(i= 0; i<objects.length; i++) {
this.setChildIndex(objects[i],0);
}
for(i= 0; i<objects.length; i++) {
trace(objects[i].name + " ahora se encuentra en el index " + this.getChildIndex(objects[i]));
}
//para enviar de un nivel a otro directamente basta con poner
this.addChildAt(objects[0],0);//manda al object0 al nivel 0
this.setChildIndex(objects[0],2) //manda al object0 al nivel 2
espero te sirva y para reforzar mirate este
tip esta muy bien explicado
Jonathan