How to set Textfield's maximum width?
I need auto-width until it gets to maximum width, so long text will break into lines.
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With