Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 Flash builder只读富文本字段?_Actionscript 3_Flash Builder_Richtextbox_Mxml - Fatal编程技术网

Actionscript 3 Flash builder只读富文本字段?

Actionscript 3 Flash builder只读富文本字段?,actionscript-3,flash-builder,richtextbox,mxml,Actionscript 3,Flash Builder,Richtextbox,Mxml,如何在flashTextArea或类似控件中显示具有简单格式(如字体颜色)的文本?我需要以编程方式将文本添加到此控件,并能够选择部分文本并将其复制到剪贴板 RichTextEditor不适合我的需要,因为它有多个控件允许用户格式化文本,并且无法禁用它们(?) 更新 另外一个问题是如何对格式进行编码。只有在以下代码中起作用: private function Print(s:String, ... optionalArgs):void { if( optionalArgs.

如何在flash
TextArea
或类似控件中显示具有简单格式(如字体颜色)的文本?我需要以编程方式将文本添加到此控件,并能够选择部分文本并将其复制到剪贴板

RichTextEditor
不适合我的需要,因为它有多个控件允许用户格式化文本,并且无法禁用它们(?)

更新

另外一个问题是如何对格式进行编码。只有
在以下代码中起作用:

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>';
            }
        }
私有函数打印(s:String,…optionalArgs):无效{
if(optionalArgs.length==0 | | optionalArgs[0]==0){
mLog.htmlText=mLog.htmlText+''+s+'
'; } else if(可选参数[0]=-1){ mLog.htmlText=mLog.htmlText+''+s+'
'; } else if(可选参数[0]==1){ mLog.htmlText=mLog.htmlText+''+s+'
'; } else if(可选参数[0]==2){ mLog.htmlText=mLog.htmlText+''+s+'
'; } 否则{ mLog.htmlText=mLog.htmlText+''+s+'
'; } }
如何编码字体颜色

解决方案


我的错误是我使用了符号颜色名称,而flash解释器看起来好像不理解它们

这实际上是一个很容易解决的问题
RichTextEditor
有一个
showControlBar
设置,如果设置为
false
,则隐藏花哨的控件

此外,您还可以访问内部文本区域并使其不可编辑(
myRTE.textArea.editable=false
),从而限制用户与文本的交互

简介:

<mx:RichTextEditor id="myRTE" showControlBar="false"... />

...

myRTE.textArea.editable = false;

...
myRTE.textArea.editable=false;


这里有一些关于格式化你的
htmlText
:,

谢谢!是否需要将RTF或HTML放入此控件?@Dims我添加了一些链接,这些链接可以帮助您进行格式设置。