# Horiz. menu with button widths based on dynamic text field width + x

**URL:** <https://forum.kirupa.com/t/horiz-menu-with-button-widths-based-on-dynamic-text-field-width-x/63520>\
**Category:** flash\
**Created:** [September 7, 2004, 5:25pm UTC](https://forum.kirupa.com/t/horiz-menu-with-button-widths-based-on-dynamic-text-field-width-x/63520 "2004-09-07T17:25:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian\_maggi](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@brian\_maggi](https://forum.kirupa.com/u/brian_maggi)\
**Post date:** [September 7, 2004, 5:25pm UTC](https://forum.kirupa.com/t/horiz-menu-with-button-widths-based-on-dynamic-text-field-width-x/63520/1 "2004-09-07T17:25:20Z")

</div>

I have done multiple searches on the forum using terms such as “relative, width, dynamic” etc. to no avail. So please forgive me if this is a basic, should-know quesiton.

I have a main nav with a horizontal roll over sub nav. I would like the \_x of each button be based on the width of each buttons’ text label plus a couple extra pixels for space.

Following is a snippet of the code I’m using.

```auto

//this is borrowed from the XML drop-down menu tutorial 
curr_item.label = curr_node.attributes.label;
// btn_label is a dynamic text field
curr_item.btn_label.autoSize = "left";
curr_item._width = curr_item.btn_label_width +5;
curr_item._y = y;
curr_item._x = x+i*curr_item._width;

```

For some reason a line such as:
