# Input textfield max width? not maxChars

**URL:** <https://forum.kirupa.com/t/input-textfield-max-width-not-maxchars/254788>\
**Category:** flash\
**Created:** [March 15, 2008, 1:44pm UTC](https://forum.kirupa.com/t/input-textfield-max-width-not-maxchars/254788 "2008-03-15T13:44:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grandpaw\_broon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/grandpaw_broon/32/3985_2.png) [@grandpaw\_broon](https://forum.kirupa.com/u/grandpaw_broon)\
**Post date:** [March 15, 2008, 1:44pm UTC](https://forum.kirupa.com/t/input-textfield-max-width-not-maxchars/254788/1 "2008-03-15T13:44:27Z")

</div>

Hey people,

Im struggling with the textfield class. I have a contact form with name, email, enquiry but i am having trouble with the textfield width:

For example, i have a sprite.

var s:Sprite = new Sprite();  
s.width = 200;  
s.height = 20;  
addChild(s);

var tf:TextField = new TextField();  
td.input = true;  
s.addChild(tf);

The problem is i need the textfield to stay at the width of its parent sprite. You would think perhaps that setting a max character would be the way forward, and that is what i have, but its not good… i mean:

WWWWWWWWWWWWWWWWWWWWWWWWW is much larger than  
iiiiiiiiiiiiiiiiiiiiiiiii

Yet they both contain 25 characters. So although it is maxed out it looks stupid.

textField.width is a read only property

textField.autosize = TextFieldAutoSize.NONE seems totally pointless because if i cant set a width before setting the Autosize to false then it means i need to fill up the textfield with just enough " "'s then force the user to delete this before wititng.

Im not really the biggest user of textfield really as i am a hobbiest but this has got me shouting at anyone silly enough to visit me! 😛

Any help would be grand,

Cheers.
