How is it possible to DISPLAY text with simple formatting (like font color) in flash TextArea or similar control? I need to add text to this control programmatically and be able to select and copy portions of it to clipboard.
RichTextEditor does not fit my needs sine it has multiple controls to allow user to format text and no way to disable them (?).
UPDATE
Additional question is how to code formatting. Only <b> does work in the following code:
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>';
}
}
How to code font color?
SOLUTION
My mistake was I was using symbolic color names, while flash interpreter looks like do not understand them
This is actually a very easy problem to solve.
RichTextEditorhas ashowControlBarsetting, which if set tofalse, hides the fancy controls.Also, you can access the internal text area and make it uneditable (
myRTE.textArea.editable= false), restricting user interaction with the text.Synopsis:
Here’s a few resources for formatting your
htmlText: Adobe ‘RichTextEditor Control’, Adobe ‘using htmlText properly’