# Programatic TextField sizing

**URL:** <https://forum.kirupa.com/t/programatic-textfield-sizing/260648>\
**Category:** flash\
**Created:** [May 18, 2008, 3:38am UTC](https://forum.kirupa.com/t/programatic-textfield-sizing/260648 "2008-05-18T03:38:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ikinsey](https://avatars.discourse-cdn.com/v4/letter/i/f14d63/32.png) [@Ikinsey](https://forum.kirupa.com/u/Ikinsey)\
**Post date:** [May 18, 2008, 3:38am UTC](https://forum.kirupa.com/t/programatic-textfield-sizing/260648/1 "2008-05-18T03:38:50Z")

</div>

Ok, so this is all in Actionscript 3.0 in Flash CS3.

I have a TextField I created and added to the stage and I want an MC to change its width to the width of the TextField whenever a new word is programmatically put into the TextField’s text property.

I handle the change, obviously, using an Event.CHANGE listener on the TextField.

The problem is, how do I get the TextField to size itself (width and height) to just fit the text that was programatically inserted? Basically, I want te field to size programmatically the way it does when you put Text on the stage and type a word into it.
