代码:
- <?xml version="1.0" encoding="utf-8"?>
- <s:Application xmlns:mx="library://ns.adobe.com/flex/mx"
- xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- width="500" height="500">
- <!--这个例子是一个简单的富文本编辑器,标题应用了style样式-->
- <fx:Script>
- <![CDATA[
- //是不是在同一文件内就可访问private声明的变量?
- private var richtext:String = "Enter text into the <b>RichTextEditor control</b>, then click a <b><font color='#0050AA'>button</font></b> to display your text as <i>plain text</i>, or as <i>HTML-formatted</i> text.";
- ]]>
- </fx:Script>
- <fx:Style>
- .white{
- color: #ffffff;
- fontWeight: bold;
- }
- </fx:Style>
- <mx:VBox width="100%" height="100%">
- <mx:RichTextEditor titleStyleName="white" id="richText" title="RichTextEditor" width="100%" height="350"
- borderAlpha="0.15" creationComplete="richText.htmlText=richtext;" />
- <s:TextArea id="textA" width="100%" height="100" />
- <mx:HBox>
- <s:Button label="显示内容" click="textA.text=richText.text;"/>
- <s:Button label="显示HTML" click="textA.text=richText.htmlText;"/>
- </mx:HBox>
- </mx:VBox>
- </s:Application>
效果:
转载于:https://blog.51cto.com/aqqle/974809