Fit width of TLFTextField to length of its html content in AS3

64 Views Asked by At

I'm going to create a "news ticker" using adobe flash. I have a single line and dynamic TLFTextField with html content. The problem I have is fitting the width of the TLFTextField to the html text length. There is a "autoSize" property that I set to left. when I set the content with text property it works but when I use htmlText property it does not fit the width. my action scpript looks like this:

var ticker:TLFTextField = TLFTextField(f0);
var text:String = 'title_1    07:45     <font color="#27ae60">***</font>      title_2     08:50     <font color="#27ae60">***</font>      title_3     09:00     <font color="#27ae60">***</font>      title_4    10:00     <font color="#27ae60">***</font>      title_5    11:00     <font color="#27ae60">***</font>      title_6     12:00     <font color="#27ae60">***</font>      title_7   13:55';
//the text would be dynamic
ticker.autoSize = TextFieldAutoSize.LEFT;
ticker.htmlText = text;
//ticker.text = text;  //when I use this the width of ticker fits the text lenght but the text is raw and html tags are not rendered

any ideas?

0

There are 0 best solutions below