Problems with attachMovie

Hey, people!

I’ve got a small issue with attachMovie.

I’ve got an array with references to movie clips which I want to place at random locations on the scene.

Here is my function:


function randomize(target_array){
	top_y = 87;
	bottom_y = 296;
	
	left_x_range = 16;
	right_x_range = 220;
	
	left_x_range_second = 305;
	right_x_range_second = 535;
	
	for(i = 0; i < target_array.length; i++){
		mc = target_array*;
		trace(mc);
		
		mc_clothes_holder.attachMovie(""+mc+"", ""+mc+"", mc_clothes_holder.getNextHighestDepth());
		
		trace("++> "+mc_clothes_holder);
		
		currY = Math.floor(Math.random() * (1 + bottom_y - top_y)) + top_y;
		
		if(i%2 != 0){
			currX = Math.floor(Math.random() * (1 + right_x_range - left_x_range)) + left_x_range;
			mc_clothes_holder.mc._x = currX;
			mc_clothes_holder.mc._y = currY;
		}else{
			currX = Math.floor(Math.random() * (1 + right_x_range_second - left_x_range_second)) + left_x_range_second;
			mc_clothes_holder.mc._x = currX;
			mc_clothes_holder.mc._y = currY;
		}
	}
}

The thing here is that the trace of “mc” in the beginning returns the correct movie clip reference, but “mc_clothes_holder.mc” after the attachMovie returns “undefined”.

Does anyone have any idea why this doesn’t work? What have I done wrong?

Thanks!