Feltope
Feltope

Reputation: 1098

TextField individual character's background colors

I am trying to set the background color for each individual character in a TextField. Setting the individual foreground colors is trivial but I am not seeing it for the background colors.

Any insight? Or do I need to roll my own.

thanks in advance.

edit: forgot to add. I am parsing a telnet stream so pushing it to htmlText would just slow things down. So that isn't an option. The output speed on the client side is time critical.

Upvotes: 1

Views: 516

Answers (2)

Marty Pitt
Marty Pitt

Reputation: 29300

You should be able to achieve this using the TLF framework, specifically by setting the foregroundColor on the appropriate FlowElement.

Upvotes: 1

jonshariat
jonshariat

Reputation: 176

You can import CSS into Flash as well as text and apply the styles. I have not used it to style background but I think it is worth the shot.

Here is a sample of the code:

var cssLoader:URLLoader = new URLLoader();
var css:StyleSheet = new StyleSheet();

function cssLoaded(e:Event):void{
    css.parseCSS(e.target.data);
    tf.styleSheet = css;

    for(var i:int = 0; i < wordList.length; i++){
        tf.htmlText += "<h4>" + wordList[i] + "</h4>";
    }

Source : AS3: Load external .txt and .css

Upvotes: 0

Related Questions