1
votes

i want to be able to change the width and height of multiline textfield, according to textfield's dynamic data. Height is not the problem but width doesn't change. Width has to be resize automatically just like single line textfield. Is there a way to do this?

i have a xml data like this:

<![CDATA[<b>some long text</b> <br> some long text <br> some long text ]]>

in actionscript:

tx_txt.autoSize = TextFieldAutoSize.LEFT;
tx_txt.htmlText = fromXML;
1
that is not i was looking for. i want the width to be automatically resizable. i edited the question a bit.atilkan

1 Answers

1
votes

I think you just want to set multiline to true and omit the width property and the field should adjust to the length of the longest line before breaking:

import flash.text.*;

var fromXML:String = "<b>some long text adfs afdsadfs afdsadfsfads</b> <br> some long text <br> some long text";

var tx_txt:TextField = new TextField();
tx_txt.autoSize = TextFieldAutoSize.LEFT;
tx_txt.multiline = true;
tx_txt.htmlText = fromXML;
tx_txt.border = true;

this.addChild(tx_txt);