Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AS3 maximum textfield's width

How to set Textfield's maximum width?
I need auto-width until it gets to maximum width, so long text will break into lines.

like image 921
vozochris Avatar asked May 24 '12 14:05

vozochris


1 Answers

var maxWidth:Number = 200;

textField.multiline = false;
textField.wordWrap = false;
textField.autoSize = TextFieldAutoSize.LEFT;

textField.text = "Lorem ipsum";

if (textField.width > maxWidth)
{
    textField.multiline = true;
    textField.wordWrap = true;
    textField.width = maxWidth;
}
like image 110
strah Avatar answered Oct 22 '22 21:10

strah