Help duplicating MCs

Hi everybody,

I am trying to figure out a script to place duplicated MCs in a row, without space between copies. The problem is that when the MC is duplicated, each copy has different _width values, so I have been trying to calculate how to do this, but I haven’t been able to find a solution. Could anyone help me with this?

Thanks a lot.


var initialX:Number = 325;
var initialY:Number = 73;
for (i = 1; i < 5; i++) {
	var name:String = "tabButton" + i + "_mc";
	var previousName:String = "tabButton" + (i - 1) + "_mc";
	_root.tab_mc.duplicateMovieClip(name, i);
	_root[name]._x = _root[previousName]._x + _root[previousName]._width;
	_root[name]._y = _root.initialY;
}