开发者

TextField individual character's background colors

开发者 https://www.devze.com 2023-02-20 01:33 出处:网络
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.

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 clien开发者_StackOverflowt side is time critical.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号