Attach movie(depths?) question

Hi all, (I am new to Flash BTW)
I have coded a class for doing a pie chart.
I’ll explain what I’m trying to do. I have two movieClips in my library and exported for the actionscript. call the first one parentClip and the other pie(which is a pie piece of approximately one degree).
So What I tried to do is to create new instances of the pie clip, rotate them and then change their color (acording to the data).
If I add the 360 copies of pie clips to _root with the attachMovie method it works, but If I create an instance of parentClip(again with attachMovie) to the _root and then I try to add the 360 copies of pie clips to the parentClip then it doesn’t work.


 class Dado {
 	var caras:Array;
 	var proba:Array; 
 	var proba_acumulada:Array;
  public function Dado() {
 ...
 // populate the caras,proba and proba_acumulada arrays
 ...
 }
 public function draw(name:String) {
 		var k,i,pos_y,pos_x,cont;
 		var depth = 1;
 		i = 0;
 		for (k = 0; k < caras.length; k++) {
 			var carta:MovieClip = _root.attachMovie("carta","carta_"+name,0);
 			trace("angulo:"+Math.round(proba_acumulada[k]*360));
 			carta._x = 200;
 			carta._y = 300;
 // If I set carta to root ie. 
 //		  carta = _root; 
 // then it works. 
 // but like this it doesn't
 			pos_x = 200;
 			pos_y = 200;
 			cont = 0;
 			while (i<Math.round(proba_acumulada[k]*360) && i<359)
 			{
 				var dpie = "pie"+k+"_"+i;
 				carta.attachMovie("pie", dpie,i);
 				carta[dpie]._rotation = -i;
 				carta[dpie]._x = pos_x;
 				carta[dpie]._y = pos_y;
 			    // mcColor set the color transform for the object with the color 
 // in an array color Hex
 				mcColor(carta[dpie], colorHex[k]);
 				++i;
 			}
 		}
 	}
 

I’m really lost here, Does anyone see the problem?
Thanks in advance