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