In a previous example, “Condensing HTML white space in the TextArea control in Flex”, we looked at how you could condense HTML formatted text in a TextArea control by setting the condenseWhite property.
The following example shows you how you can condense white space around HTML tags using the Flex RichTextEditor control, the htmlText property, and the condenseWhite property.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/04/24/condensing-html-white-space-in-the-richtexteditor-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
private function checkBox_change(evt:Event):void {
richTextEditor.textArea.condenseWhite = checkBox.selected;
}
]]>
</mx:Script>
<mx:String id="str" source="lorem.html" />
<mx:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="condenseWhite:">
<mx:CheckBox id="checkBox"
change="checkBox_change(event);" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:RichTextEditor id="richTextEditor"
htmlText="{str}"
width="100%"
height="100%" />
</mx:Application>
View source is enabled in the following example.


