This content has been marked as final. Show 4 replies
You can only in pixels:
my_txt._width = 5;
where my_txt is your dynamic TextField
are you wanting to size the text box to its contents? TextField.autoSize will do that.
There's no such thing as a global character width in majority of fonts which are proportional(a small percentage are monospace - courier etc but for aesthetic reasons it's unlikely you would be using one)
If you did need an average character width for some reason you could use (TextField.textWidth/TextField.length) of a textfield with text in it(assuming it was only one line).
Alternatively again, if you were talking about restricting the user from inputting more than a certain number of characters you could use TextField.maxChars.
my_txt.maxChars = 5;
Thank you very much, very helpful