0
在flash或类似的控件中,如何以简单格式(如字体颜色)显示文本?我需要以编程方式向此控件添加文本,并且能够选择并将其部分复制到剪贴板。Flash Builder只读富文本字段?
RichTextEditor
不符合我的需要正弦它有多个控件允许用户格式化文本,并且没有办法禁用它们(?)。
UPDATE
另一个问题是如何编码格式。只有<b>
下面的代码确实工作:
private function Print(s:String, ... optionalArgs):void {
if(optionalArgs.length == 0 || optionalArgs[0]==0) {
mLog.htmlText = mLog.htmlText + '<b>' + s + '</b><br>';
}
else if(optionalArgs[0]==-1) {
mLog.htmlText = mLog.htmlText + '<font color=\"red\">' + s + '</font><br>';
}
else if(optionalArgs[0]==1) {
mLog.htmlText = mLog.htmlText + '<span style=\"color:green\">' + s + '</span><br>';
}
else if(optionalArgs[0]==2) {
mLog.htmlText = mLog.htmlText + '<span style=\"color:blue\">' + s + '</span><br>';
}
else {
mLog.htmlText = mLog.htmlText + '<b>' + s + '</b><br>';
}
}
如何编写代码的字体颜色?
SOLUTION
我的错误是我用的是象征性的颜色名称,而Flash解释貌似不理解他们
谢谢!我是否需要将RTF或HTML放入此控件中? – Dims 2012-03-19 20:20:46
@Dims我添加了一些链接,可以帮助您排除格式。 – 2012-03-20 13:05:42