Resize dynamic textbox with AS?

hey,

i am building a simple menu using duplicate movieclip.

on the stage i have an mc (testButton) and inside that i have a dynamic text box with instance name “buttNameBox” and var name “buttName”.

to creat the nav, i have written this code:


topNavNames = ["BUTTON1", "BN2", "BU3", "BUN4", "BUTTON5"];

testButton._visible = 0;
for (i=0; i<topNavNames.length; i++) {
	this["topButt"+i].buttNameBox.autoSize = "left";
	testButton.duplicateMovieClip("topButt"+i, i);
	this["topButt"+i]._width = this["topButt"+i].buttNameBox._width
	this["topButt"+i]._x = (this["topButt"+i]._width*i)+(i*30);
	
	this["topButt"+i].buttName = topNavNames[this.i];
	//button actions
	this["topButt"+i].i = i;
	this["topButt"+i].onPress = function() {
		trace(this.i+1);
	};
}


ok so it works fine as far as creating the buttons and filling the text fields with the array titles, but i want the size of each button to be dependant on the title of the button (mainly so the gap between buttons is the same no matter how long the title).

I tried the autoSize property, but no joy.

can anybody help?

cheers

kd