# MC that resizes according to text length

**URL:** https://forum.kirupa.com/t/mc-that-resizes-according-to-text-length/202140
**Category:** flash
**Created:** [September 28, 2006, 3:54am UTC](https://forum.kirupa.com/t/mc-that-resizes-according-to-text-length/202140 "2006-09-28T03:54:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![schmichael](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@schmichael](https://forum.kirupa.com/u/schmichael)
#### Post date: [September 28, 2006, 3:54am UTC](https://forum.kirupa.com/t/mc-that-resizes-according-to-text-length/202140/1 "2006-09-28T03:54:34Z")

</div>

Hiya, I am trying to create a movieclip that can be used as a button that has a textfield and also a box in the background behind the textfield that is relative to the width of the textfield. I want to do this so I can dynamically create a bunch of these MCs with different text as labels and that are all different widths according to how long the text is. The end result should be a bunch of MCs that have different text on them and that have boxes of varying widths relative to the text they contain.

When I create a textfield dynamically I have to specify the width first and so I can’t figure out how to choose the width after I have created the textfield, determined by it’s contents.

is there any way to do this without using fixed-width fonts and calculating the size of the textfield from this first before it is created? This is the only way i can think to do this.

Any sugggestions very gratefully received.  
Thanks!  
Schm
