views:

688

answers:

2

what is the best way to use more than 1 font color with textField.htmlText

I already use code like:

textField.htmlText = "blaa blaa" + "< u >"+w+"< /u >"+"blaa blaa"

How can I make that to define a specific color as well?

+2  A: 

Use flash.text.StyleSheet

var style:StyleSheet = new StyleSheet();
var underline:Object = new Object();
underline.fontWeight = "bold";
underline.color = "#FF0000";
underline.display = "inline";

style.setStyle("u", underline);

textField.styleSheet = style;
textField.htmlText = "blaa blaa" + "< u >"+w+"< /u >"+"blaa blaa"
Jeff Winkworth
thanks, but there is now a weird LINEFEED after +w+ caused by stylesheet?
Tom
I found FONT Tag easier
Tom
StyleSheets are a prettier way of doing it, you just have to remember to set your styles as inline to get rid of the linebreak after them.
grapefrukt
A: 

FONT Tag is easier

Tom