# Resize dynamic textbox with AS?

**URL:** <https://forum.kirupa.com/t/resize-dynamic-textbox-with-as/129114>\
**Category:** Uncategorized\
**Created:** [November 19, 2004, 4:07pm UTC](https://forum.kirupa.com/t/resize-dynamic-textbox-with-as/129114 "2004-11-19T16:07:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kdzines](https://avatars.discourse-cdn.com/v4/letter/k/7ea924/32.png) [@kdzines](https://forum.kirupa.com/u/kdzines)\
**Post date:** [November 19, 2004, 4:07pm UTC](https://forum.kirupa.com/t/resize-dynamic-textbox-with-as/129114/1 "2004-11-19T16:07:31Z")

</div>

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:

```auto

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
