Spark TextArea - 更改部分文本颜色

Posted

技术标签:

【中文标题】Spark TextArea - 更改部分文本颜色【英文标题】:Spark TextArea - Change part of text color 【发布时间】:2012-10-25 10:35:17 【问题描述】:

如何更改spark.components.TextArea 中的部分文本颜色?

【问题讨论】:

【参考方案1】:

TextArea 可以做到这一点。试试这个:

    var format:TextLayoutFormat = new TextLayoutFormat();
    format.color = 0x00ff00;            
    this.textarea.setFormatOfRange(format, startIndex, endIndex);

【讨论】:

【参考方案2】:

好吧,TextArea 不能这样做。你应该试试 RichText 或一些相关的组件。

http://help.adobe.com/en_US/flex/using/WS02f7d8d4857b1677-165a04e1126951a2d98-7fca.html

【讨论】:

以上是关于Spark TextArea - 更改部分文本颜色的主要内容,如果未能解决你的问题,请参考以下文章