<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; TextFlow</title>
	<atom:link href="http://blog.flexexamples.com/category/textflow/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Exporting a TextFlow object in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/07/25/exporting-a-textflow-object-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/07/25/exporting-a-textflow-object-in-flex-4/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 18:09:28 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta1]]></category>
		<category><![CDATA[TextConverter]]></category>
		<category><![CDATA[TextFlow]]></category>
		<category><![CDATA[export()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=1240</guid>
		<description><![CDATA[<p>The following example shows how you can export a TextFlow object in Flex 4 by using the TextConverter class (flashx.textLayout.conversion.TextConverter), and specifying HTML format, plain text format, or Text Layout Format.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2009/07/25/exporting-a-textflow-object-in-flex-4/ --&#62; &#60;s:Application name=&#34;Spark_TextConverter_export_test&#34; xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/halo&#34; xmlns:comps=&#34;comps.*&#34;&#62; &#60;s:layout&#62; &#60;s:VerticalLayout paddingLeft=&#34;20&#34; paddingRight=&#34;20&#34; paddingTop=&#34;20&#34; paddingBottom=&#34;20&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can export a TextFlow object in Flex 4 by using the TextConverter class (flashx.textLayout.conversion.TextConverter), and specifying HTML format, plain text format, or Text Layout Format.</p>
<p>Full code after the jump.</p>
<p><span id="more-1240"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/07/25/exporting-a-textflow-object-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_TextConverter_export_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span></span>
<span style="color: #000000;">        xmlns:comps=<span style="color: #ff0000;">&quot;comps.*&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span> paddingLeft=<span style="color: #ff0000;">&quot;20&quot;</span> paddingRight=<span style="color: #ff0000;">&quot;20&quot;</span></span>
<span style="color: #000000;">                paddingTop=<span style="color: #ff0000;">&quot;20&quot;</span> paddingBottom=<span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import flashx.textLayout.conversion.ConversionType;</span>
<span style="color: #000000;">            import flashx.textLayout.conversion.TextConverter;</span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;comps:CustomEditor</span> id=<span style="color: #ff0000;">&quot;customEditor&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HGroup</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;htmlBtn&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Export as HTML&quot;</span></span>
<span style="color: #000000;">                click=<span style="color: #ff0000;">&quot;debug.text = TextConverter.export(customEditor.editor.textFlow,</span>
<span style="color: #000000;">                                        TextConverter.HTML_FORMAT,</span>
<span style="color: #000000;">                                        ConversionType.STRING_TYPE).toString();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;plainTxtBtn&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Export as plain text&quot;</span></span>
<span style="color: #000000;">                click=<span style="color: #ff0000;">&quot;debug.text = TextConverter.export(customEditor.editor.textFlow,</span>
<span style="color: #000000;">                                        TextConverter.PLAIN_TEXT_FORMAT,</span>
<span style="color: #000000;">                                        ConversionType.STRING_TYPE).toString();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Button</span> id=<span style="color: #ff0000;">&quot;tlfBtn&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Export as TLF&quot;</span></span>
<span style="color: #000000;">                click=<span style="color: #ff0000;">&quot;debug.text = TextConverter.export(customEditor.editor.textFlow,</span>
<span style="color: #000000;">                                        TextConverter.TEXT_LAYOUT_FORMAT,</span>
<span style="color: #000000;">                                        ConversionType.STRING_TYPE).toString();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:HGroup</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextArea</span> id=<span style="color: #ff0000;">&quot;debug&quot;</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_TextConverter_export_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_TextConverter_export_test/bin/main.html" width="100%" height="500"></iframe></p>
<p>And the custom rich text editor component, comps/CustomEditor.mxml, is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/07/25/exporting-a-textflow-object-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Panel</span> name=<span style="color: #ff0000;">&quot;CustomEditor&quot;</span></span>
<span style="color: #000000;">         xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">         xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">         xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span></span>
<span style="color: #000000;">        title=<span style="color: #ff0000;">&quot;SimpleTextEditor&quot;</span> minWidth=<span style="color: #ff0000;">&quot;400&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span> gap=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import flashx.textLayout.conversion.ConversionType;</span>
<span style="color: #000000;">            import flashx.textLayout.conversion.TextConverter;</span>
<span style="color: #000000;">            import flash.text.engine.FontPosture;</span>
<span style="color: #000000;">            import flash.text.engine.FontWeight;</span>
<span style="color: #000000;">            import flashx.textLayout.formats.TextAlign;</span>
<span style="color: #000000;">            import flashx.textLayout.formats.TextDecoration;</span>
<span style="color: #000000;">            import flashx.textLayout.formats.TextLayoutFormat;</span>
<span style="color: #000000;">            import mx.events.ColorPickerEvent;</span>
<span style="color: #000000;">            import mx.events.FlexEvent;</span>
<span style="color: #000000;">            import spark.events.IndexChangeEvent;</span>
&nbsp;
<span style="color: #000000;">            protected function editor_selectionChangeHandler<span style="color: #66cc66;">&#40;</span>evt:FlexEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                fontDDL.selectedItem = txtLayFmt.fontFamily;</span>
<span style="color: #000000;">                sizeDDL.selectedItem = txtLayFmt.fontSize;</span>
<span style="color: #000000;">                boldBtn.selected = <span style="color: #66cc66;">&#40;</span>txtLayFmt.fontWeight == FontWeight.BOLD<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                italBtn.selected = <span style="color: #66cc66;">&#40;</span>txtLayFmt.fontStyle == FontPosture.ITALIC<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                underBtn.selected = <span style="color: #66cc66;">&#40;</span>txtLayFmt.textDecoration == TextDecoration.UNDERLINE<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                colorCP.selectedColor = txtLayFmt.color;</span>
<span style="color: #000000;">                lineBtn.selected = txtLayFmt.lineThrough;</span>
&nbsp;
<span style="color: #000000;">                switch <span style="color: #66cc66;">&#40;</span>txtLayFmt.textAlign<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    case TextAlign.LEFT:</span>
<span style="color: #000000;">                        txtAlignBB.selectedIndex = <span style="color: #cc66cc;">0</span>;</span>
<span style="color: #000000;">                        break;</span>
<span style="color: #000000;">                    case TextAlign.CENTER:</span>
<span style="color: #000000;">                        txtAlignBB.selectedIndex = <span style="color: #cc66cc;">1</span>;</span>
<span style="color: #000000;">                        break;</span>
<span style="color: #000000;">                    case TextAlign.RIGHT:</span>
<span style="color: #000000;">                        txtAlignBB.selectedIndex = <span style="color: #cc66cc;">2</span>;</span>
<span style="color: #000000;">                        break;</span>
<span style="color: #000000;">                    case TextAlign.JUSTIFY:</span>
<span style="color: #000000;">                        txtAlignBB.selectedIndex = <span style="color: #cc66cc;">3</span>;</span>
<span style="color: #000000;">                        break;</span>
<span style="color: #000000;">                    default:</span>
<span style="color: #000000;">                        txtAlignBB.selectedIndex = -<span style="color: #cc66cc;">1</span>;</span>
<span style="color: #000000;">                        break;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function fontDDL_changeHandler<span style="color: #66cc66;">&#40;</span>evt:IndexChangeEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.fontFamily = fontDDL.selectedItem;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function sizeDDL_changeHandler<span style="color: #66cc66;">&#40;</span>evt:IndexChangeEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.fontSize = sizeDDL.selectedItem;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function boldBtn_clickHandler<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.fontWeight = <span style="color: #66cc66;">&#40;</span>txtLayFmt.fontWeight == FontWeight.BOLD<span style="color: #66cc66;">&#41;</span> ? FontWeight.NORMAL : FontWeight.BOLD;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function italBtn_clickHandler<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.fontStyle = <span style="color: #66cc66;">&#40;</span>txtLayFmt.fontStyle == FontPosture.ITALIC<span style="color: #66cc66;">&#41;</span> ? FontPosture.NORMAL : FontPosture.ITALIC;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function underBtn_clickHandler<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.textDecoration = <span style="color: #66cc66;">&#40;</span>txtLayFmt.fontStyle == TextDecoration.UNDERLINE<span style="color: #66cc66;">&#41;</span> ? TextDecoration.NONE : TextDecoration.UNDERLINE;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function colorCP_changeHandler<span style="color: #66cc66;">&#40;</span>evt:ColorPickerEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.color = colorCP.selectedColor;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function txtAlignBB_changeHandler<span style="color: #66cc66;">&#40;</span>evt:IndexChangeEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span>txtAlignBB.selectedItem<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                        editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                        editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                    txtLayFmt.textAlign = txtAlignBB.selectedItem.value;</span>
<span style="color: #000000;">                    editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                        editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                        editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                    editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function lineBtn_clickHandler<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.lineThrough = lineBtn.selected;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextArea</span> id=<span style="color: #ff0000;">&quot;editor&quot;</span></span>
<span style="color: #000000;">            focusEnabled=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span></span>
<span style="color: #000000;">            minHeight=<span style="color: #ff0000;">&quot;200&quot;</span></span>
<span style="color: #000000;">            selectionChange=<span style="color: #ff0000;">&quot;editor_selectionChangeHandler(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:textFlow</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextFlow</span> paragraphSpaceBefore=<span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:p</span><span style="color: #7400FF;">&gt;</span></span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis et nibh lorem. Nulla ut velit magna. Nunc quis libero ac orci porta tincidunt eget in lorem. Aenean vitae nisi vitae urna lacinia congue. Duis nec leo turpis. Phasellus dui orci, lacinia in dictum lacinia, ullamcorper a tortor. Suspendisse lacinia, turpis vel euismod gravida, turpis dui vulputate libero, vel consequat enim sem nec mauris. Curabitur vitae magna vel neque accumsan commodo vitae quis ipsum. Nullam ac condimentum elit. Integer eget magna ac mi fermentum luctus. Ut pharetra auctor pulvinar. Duis lobortis, nulla at vestibulum tincidunt, ante neque scelerisque risus, ac dignissim nunc nisl rhoncus risus. Cras pretium egestas purus, a commodo nunc vehicula at. Fusce vestibulum enim in mi hendrerit a viverra justo tempor. Maecenas eget ipsum ac mauris dictum congue eu id justo.<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:p</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:p</span><span style="color: #7400FF;">&gt;</span></span>Aliquam tincidunt tempor nisi id porta. Aenean risus dolor, tincidunt a ultrices in, laoreet eu ante. Mauris vel lacus neque, ut scelerisque eros. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec vel lacus sit amet erat vehicula malesuada id in augue. Sed purus massa, placerat non imperdiet nec, venenatis a nulla. Donec vel ligula leo, in rhoncus arcu. Duis semper bibendum facilisis. Duis nibh lorem, egestas rutrum tincidunt non, vulputate accumsan nulla. Nunc ligula nisl, ultrices ut tempor quis, rutrum et enim. Nullam accumsan scelerisque ante id pretium. Mauris nibh metus, blandit in varius congue, pharetra sit amet sem. Phasellus tincidunt lacus quis est semper ut rhoncus sem pretium. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar, enim eu consectetur venenatis, dui tortor commodo ante, sit amet sagittis libero odio cursus neque. Aliquam a dui non eros placerat euismod. In at mattis felis. Suspendisse potenti. Morbi posuere condimentum lacus. Suspendisse tellus magna, viverra ac mattis vel, adipiscing eget lectus.<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:p</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:p</span><span style="color: #7400FF;">&gt;</span></span>Etiam ut eros lectus. Praesent nec massa nibh. Cras venenatis, ligula in condimentum euismod, nisl lorem hendrerit lacus, a imperdiet odio est et odio. Suspendisse eu orci ut augue commodo gravida sed eu risus. Vestibulum venenatis erat ac metus ullamcorper blandit. Integer et sem enim. Vivamus a arcu metus. Nunc sollicitudin commodo placerat. Maecenas vehicula, massa et auctor tempor, felis leo commodo lorem, eget pulvinar felis turpis nec erat. Mauris imperdiet gravida felis a eleifend.<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:p</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:p</span><span style="color: #7400FF;">&gt;</span></span>Suspendisse mattis tempor fringilla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sed molestie arcu. Praesent ut tellus sed orci blandit tristique non eget est. Sed interdum feugiat nisi, sit amet aliquet enim sodales non. Maecenas in velit sit amet tellus tincidunt dapibus. Vivamus est eros, iaculis et venenatis a, malesuada vel lacus. Aliquam vel orci tortor. Etiam ornare ante eget massa dignissim a auctor nunc pellentesque. Pellentesque sodales porta nisi, pretium accumsan eros tincidunt vitae. Cras facilisis accumsan purus ultricies lacinia. Praesent consequat elit imperdiet tellus vehicula ut ornare mauris mattis. Suspendisse non tortor nisl. Etiam ac pretium est.<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:p</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:p</span><span style="color: #7400FF;">&gt;</span></span>Maecenas tristique, velit aliquam faucibus ornare, justo erat porta elit, sed venenatis neque mi ac elit. Nullam enim metus, gravida ac euismod sit amet, commodo vitae elit. Quisque eget molestie ante. Nulla fermentum pretium augue non tristique. Praesent in orci eu diam ultrices sodales ac quis leo. Aliquam lobortis elit quis mi rutrum feugiat. Aenean sed elit turpis. Duis enim ligula, posuere sit amet semper a, pretium vel leo. Etiam mollis dolor nec elit suscipit imperdiet. Sed a est eros.<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:p</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:TextFlow</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:textFlow</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:TextArea</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ControlBar</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> cornerRadius=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ToolBar</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> horizontalGap=<span style="color: #ff0000;">&quot;5&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:DropDownList</span> id=<span style="color: #ff0000;">&quot;fontDDL&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;150&quot;</span></span>
<span style="color: #000000;">                    change=<span style="color: #ff0000;">&quot;fontDDL_changeHandler(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ArrayList</span> source=<span style="color: #ff0000;">&quot;[Arial,Verdana,Times New Roman,Trebuchet MS]&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:DropDownList</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:DropDownList</span> id=<span style="color: #ff0000;">&quot;sizeDDL&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;60&quot;</span></span>
<span style="color: #000000;">                    change=<span style="color: #ff0000;">&quot;sizeDDL_changeHandler(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ArrayList</span> source=<span style="color: #ff0000;">&quot;[8,10,12,14,16,24,36,72]&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:DropDownList</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ToggleButton</span> id=<span style="color: #ff0000;">&quot;boldBtn&quot;</span></span>
<span style="color: #000000;">                    label=<span style="color: #ff0000;">&quot;B&quot;</span></span>
<span style="color: #000000;">                    fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;30&quot;</span></span>
<span style="color: #000000;">                    click=<span style="color: #ff0000;">&quot;boldBtn_clickHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ToggleButton</span> id=<span style="color: #ff0000;">&quot;italBtn&quot;</span></span>
<span style="color: #000000;">                    label=<span style="color: #ff0000;">&quot;I&quot;</span></span>
<span style="color: #000000;">                    fontStyle=<span style="color: #ff0000;">&quot;italic&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;30&quot;</span></span>
<span style="color: #000000;">                    click=<span style="color: #ff0000;">&quot;italBtn_clickHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ToggleButton</span> id=<span style="color: #ff0000;">&quot;underBtn&quot;</span></span>
<span style="color: #000000;">                    label=<span style="color: #ff0000;">&quot;U&quot;</span> </span>
<span style="color: #000000;">                    textDecoration=<span style="color: #ff0000;">&quot;underline&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;30&quot;</span></span>
<span style="color: #000000;">                    click=<span style="color: #ff0000;">&quot;underBtn_clickHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ToggleButton</span> id=<span style="color: #ff0000;">&quot;lineBtn&quot;</span></span>
<span style="color: #000000;">                    label=<span style="color: #ff0000;">&quot;S&quot;</span></span>
<span style="color: #000000;">                    lineThrough=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;30&quot;</span></span>
<span style="color: #000000;">                    click=<span style="color: #ff0000;">&quot;lineBtn_clickHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColorPicker</span> id=<span style="color: #ff0000;">&quot;colorCP&quot;</span></span>
<span style="color: #000000;">                    change=<span style="color: #ff0000;">&quot;colorCP_changeHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ButtonBar</span> id=<span style="color: #ff0000;">&quot;txtAlignBB&quot;</span></span>
<span style="color: #000000;">                    arrowKeysWrapFocus=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                    labelField=<span style="color: #ff0000;">&quot;label&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;120&quot;</span></span>
<span style="color: #000000;">                    change=<span style="color: #ff0000;">&quot;txtAlignBB_changeHandler(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ArrayList</span><span style="color: #7400FF;">&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Object</span> label=<span style="color: #ff0000;">&quot;L&quot;</span> value=<span style="color: #ff0000;">&quot;{TextAlign.LEFT}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Object</span> label=<span style="color: #ff0000;">&quot;C&quot;</span> value=<span style="color: #ff0000;">&quot;{TextAlign.CENTER}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Object</span> label=<span style="color: #ff0000;">&quot;R&quot;</span> value=<span style="color: #ff0000;">&quot;{TextAlign.RIGHT}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Object</span> label=<span style="color: #ff0000;">&quot;J&quot;</span> value=<span style="color: #ff0000;">&quot;{TextAlign.JUSTIFY}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:ArrayList</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:ButtonBar</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ToolBar</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ControlBar</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Panel</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Exporting a TextFlow object in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/07/25/exporting-a-textflow-object-in-flex-4/',contentID: 'post-1240',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'export(),TextFlow',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/07/25/exporting-a-textflow-object-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Creating a simple text editor using the Spark TextArea control in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/07/24/creating-a-simple-text-editor-using-the-spark-textarea-control-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/07/24/creating-a-simple-text-editor-using-the-spark-textarea-control-in-flex-4/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 17:43:36 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta1]]></category>
		<category><![CDATA[TextArea (Spark)]]></category>
		<category><![CDATA[TextFlow]]></category>
		<category><![CDATA[TextLayoutFormat]]></category>
		<category><![CDATA[getFormatOfRange()]]></category>
		<category><![CDATA[selectionActivePosition]]></category>
		<category><![CDATA[selectionAnchorPosition]]></category>
		<category><![CDATA[setFocus()]]></category>
		<category><![CDATA[setFormatOfRange()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=1237</guid>
		<description><![CDATA[<p>The following example shows how you can create a simple rich text editor control in Flex 4 using the Spark TextArea control and using the getFormatOfRange() and setFormatOfRange() methods.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2009/07/24/creating-a-simple-text-editor-using-the-spark-textarea-control-in-flex-4/ --&#62; &#60;s:Application name=&#34;Spark_TextArea_setFormatOfRange_test&#34; xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/halo&#34;&#62; &#160; &#60;fx:Script&#62; &#60;!&#91;CDATA&#91; import flash.text.engine.FontPosture; import flash.text.engine.FontWeight; import flashx.textLayout.formats.TextAlign; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can create a simple rich text editor control in Flex 4 using the Spark TextArea control and using the <code>getFormatOfRange()</code> and <code>setFormatOfRange()</code> methods.</p>
<p>Full code after the jump.</p>
<p><span id="more-1237"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/07/24/creating-a-simple-text-editor-using-the-spark-textarea-control-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_TextArea_setFormatOfRange_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import flash.text.engine.FontPosture;</span>
<span style="color: #000000;">            import flash.text.engine.FontWeight;</span>
<span style="color: #000000;">            import flashx.textLayout.formats.TextAlign;</span>
<span style="color: #000000;">            import flashx.textLayout.formats.TextDecoration;</span>
<span style="color: #000000;">            import flashx.textLayout.formats.TextLayoutFormat;</span>
<span style="color: #000000;">            import mx.events.ColorPickerEvent;</span>
<span style="color: #000000;">            import mx.events.FlexEvent;</span>
<span style="color: #000000;">            import spark.events.IndexChangeEvent;</span>
&nbsp;
<span style="color: #000000;">            protected function editor_selectionChangeHandler<span style="color: #66cc66;">&#40;</span>evt:FlexEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                fontDDL.selectedItem = txtLayFmt.fontFamily;</span>
<span style="color: #000000;">                sizeDDL.selectedItem = txtLayFmt.fontSize;</span>
<span style="color: #000000;">                boldBtn.selected = <span style="color: #66cc66;">&#40;</span>txtLayFmt.fontWeight == FontWeight.BOLD<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                italBtn.selected = <span style="color: #66cc66;">&#40;</span>txtLayFmt.fontStyle == FontPosture.ITALIC<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                underBtn.selected = <span style="color: #66cc66;">&#40;</span>txtLayFmt.textDecoration == TextDecoration.UNDERLINE<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                colorCP.selectedColor = txtLayFmt.color;</span>
<span style="color: #000000;">                lineBtn.selected = txtLayFmt.lineThrough;</span>
&nbsp;
<span style="color: #000000;">                switch <span style="color: #66cc66;">&#40;</span>txtLayFmt.textAlign<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    case TextAlign.LEFT:</span>
<span style="color: #000000;">                        txtAlignBB.selectedIndex = <span style="color: #cc66cc;">0</span>;</span>
<span style="color: #000000;">                        break;</span>
<span style="color: #000000;">                    case TextAlign.CENTER:</span>
<span style="color: #000000;">                        txtAlignBB.selectedIndex = <span style="color: #cc66cc;">1</span>;</span>
<span style="color: #000000;">                        break;</span>
<span style="color: #000000;">                    case TextAlign.RIGHT:</span>
<span style="color: #000000;">                        txtAlignBB.selectedIndex = <span style="color: #cc66cc;">2</span>;</span>
<span style="color: #000000;">                        break;</span>
<span style="color: #000000;">                    case TextAlign.JUSTIFY:</span>
<span style="color: #000000;">                        txtAlignBB.selectedIndex = <span style="color: #cc66cc;">3</span>;</span>
<span style="color: #000000;">                        break;</span>
<span style="color: #000000;">                    default:</span>
<span style="color: #000000;">                        txtAlignBB.selectedIndex = -<span style="color: #cc66cc;">1</span>;</span>
<span style="color: #000000;">                        break;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function fontDDL_changeHandler<span style="color: #66cc66;">&#40;</span>evt:IndexChangeEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.fontFamily = fontDDL.selectedItem;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function sizeDDL_changeHandler<span style="color: #66cc66;">&#40;</span>evt:IndexChangeEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.fontSize = sizeDDL.selectedItem;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function boldBtn_clickHandler<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.fontWeight = <span style="color: #66cc66;">&#40;</span>txtLayFmt.fontWeight == FontWeight.BOLD<span style="color: #66cc66;">&#41;</span> ? FontWeight.NORMAL : FontWeight.BOLD;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function italBtn_clickHandler<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.fontStyle = <span style="color: #66cc66;">&#40;</span>txtLayFmt.fontStyle == FontPosture.ITALIC<span style="color: #66cc66;">&#41;</span> ? FontPosture.NORMAL : FontPosture.ITALIC;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function underBtn_clickHandler<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.textDecoration = <span style="color: #66cc66;">&#40;</span>txtLayFmt.textDecoration == TextDecoration.UNDERLINE<span style="color: #66cc66;">&#41;</span> ? TextDecoration.NONE : TextDecoration.UNDERLINE;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function colorCP_changeHandler<span style="color: #66cc66;">&#40;</span>evt:ColorPickerEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.color = colorCP.selectedColor;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function txtAlignBB_changeHandler<span style="color: #66cc66;">&#40;</span>evt:IndexChangeEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                if <span style="color: #66cc66;">&#40;</span>txtAlignBB.selectedItem<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                    txtLayFmt.textAlign = txtAlignBB.selectedItem.value;</span>
<span style="color: #000000;">                    editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                    editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                    editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                    editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function lineBtn_clickHandler<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var txtLayFmt:TextLayoutFormat = editor.getFormatOfRange<span style="color: #66cc66;">&#40;</span>null,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                txtLayFmt.lineThrough = lineBtn.selected;</span>
<span style="color: #000000;">                editor.setFormatOfRange<span style="color: #66cc66;">&#40;</span>txtLayFmt,</span>
<span style="color: #000000;">                                editor.selectionAnchorPosition,</span>
<span style="color: #000000;">                                editor.selectionActivePosition<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                editor.setFocus<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Panel</span> title=<span style="color: #ff0000;">&quot;SimpleTextEditor&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;400&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span> gap=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextArea</span> id=<span style="color: #ff0000;">&quot;editor&quot;</span></span>
<span style="color: #000000;">                focusEnabled=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #000000;">                width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span></span>
<span style="color: #000000;">                minHeight=<span style="color: #ff0000;">&quot;200&quot;</span></span>
<span style="color: #000000;">                selectionChange=<span style="color: #ff0000;">&quot;editor_selectionChangeHandler(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:textFlow</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextFlow</span> paragraphSpaceBefore=<span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:p</span><span style="color: #7400FF;">&gt;</span></span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis et nibh lorem. Nulla ut velit magna. Nunc quis libero ac orci porta tincidunt eget in lorem. Aenean vitae nisi vitae urna lacinia congue. Duis nec leo turpis. Phasellus dui orci, lacinia in dictum lacinia, ullamcorper a tortor. Suspendisse lacinia, turpis vel euismod gravida, turpis dui vulputate libero, vel consequat enim sem nec mauris. Curabitur vitae magna vel neque accumsan commodo vitae quis ipsum. Nullam ac condimentum elit. Integer eget magna ac mi fermentum luctus. Ut pharetra auctor pulvinar. Duis lobortis, nulla at vestibulum tincidunt, ante neque scelerisque risus, ac dignissim nunc nisl rhoncus risus. Cras pretium egestas purus, a commodo nunc vehicula at. Fusce vestibulum enim in mi hendrerit a viverra justo tempor. Maecenas eget ipsum ac mauris dictum congue eu id justo.<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:p</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:p</span><span style="color: #7400FF;">&gt;</span></span>Aliquam tincidunt tempor nisi id porta. Aenean risus dolor, tincidunt a ultrices in, laoreet eu ante. Mauris vel lacus neque, ut scelerisque eros. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec vel lacus sit amet erat vehicula malesuada id in augue. Sed purus massa, placerat non imperdiet nec, venenatis a nulla. Donec vel ligula leo, in rhoncus arcu. Duis semper bibendum facilisis. Duis nibh lorem, egestas rutrum tincidunt non, vulputate accumsan nulla. Nunc ligula nisl, ultrices ut tempor quis, rutrum et enim. Nullam accumsan scelerisque ante id pretium. Mauris nibh metus, blandit in varius congue, pharetra sit amet sem. Phasellus tincidunt lacus quis est semper ut rhoncus sem pretium. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar, enim eu consectetur venenatis, dui tortor commodo ante, sit amet sagittis libero odio cursus neque. Aliquam a dui non eros placerat euismod. In at mattis felis. Suspendisse potenti. Morbi posuere condimentum lacus. Suspendisse tellus magna, viverra ac mattis vel, adipiscing eget lectus.<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:p</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:p</span><span style="color: #7400FF;">&gt;</span></span>Etiam ut eros lectus. Praesent nec massa nibh. Cras venenatis, ligula in condimentum euismod, nisl lorem hendrerit lacus, a imperdiet odio est et odio. Suspendisse eu orci ut augue commodo gravida sed eu risus. Vestibulum venenatis erat ac metus ullamcorper blandit. Integer et sem enim. Vivamus a arcu metus. Nunc sollicitudin commodo placerat. Maecenas vehicula, massa et auctor tempor, felis leo commodo lorem, eget pulvinar felis turpis nec erat. Mauris imperdiet gravida felis a eleifend.<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:p</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:p</span><span style="color: #7400FF;">&gt;</span></span>Suspendisse mattis tempor fringilla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sed molestie arcu. Praesent ut tellus sed orci blandit tristique non eget est. Sed interdum feugiat nisi, sit amet aliquet enim sodales non. Maecenas in velit sit amet tellus tincidunt dapibus. Vivamus est eros, iaculis et venenatis a, malesuada vel lacus. Aliquam vel orci tortor. Etiam ornare ante eget massa dignissim a auctor nunc pellentesque. Pellentesque sodales porta nisi, pretium accumsan eros tincidunt vitae. Cras facilisis accumsan purus ultricies lacinia. Praesent consequat elit imperdiet tellus vehicula ut ornare mauris mattis. Suspendisse non tortor nisl. Etiam ac pretium est.<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:p</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:p</span><span style="color: #7400FF;">&gt;</span></span>Maecenas tristique, velit aliquam faucibus ornare, justo erat porta elit, sed venenatis neque mi ac elit. Nullam enim metus, gravida ac euismod sit amet, commodo vitae elit. Quisque eget molestie ante. Nulla fermentum pretium augue non tristique. Praesent in orci eu diam ultrices sodales ac quis leo. Aliquam lobortis elit quis mi rutrum feugiat. Aenean sed elit turpis. Duis enim ligula, posuere sit amet semper a, pretium vel leo. Etiam mollis dolor nec elit suscipit imperdiet. Sed a est eros.<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:p</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:TextFlow</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:textFlow</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:TextArea</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ControlBar</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> cornerRadius=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ToolBar</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> horizontalGap=<span style="color: #ff0000;">&quot;5&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:DropDownList</span> id=<span style="color: #ff0000;">&quot;fontDDL&quot;</span></span>
<span style="color: #000000;">                        width=<span style="color: #ff0000;">&quot;150&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;fontDDL_changeHandler(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ArrayList</span> source=<span style="color: #ff0000;">&quot;[Arial,Verdana,Times New Roman,Trebuchet MS]&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:DropDownList</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:DropDownList</span> id=<span style="color: #ff0000;">&quot;sizeDDL&quot;</span></span>
<span style="color: #000000;">                        width=<span style="color: #ff0000;">&quot;60&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;sizeDDL_changeHandler(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ArrayList</span> source=<span style="color: #ff0000;">&quot;[8,10,12,14,16,24,36,72]&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:DropDownList</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ToggleButton</span> id=<span style="color: #ff0000;">&quot;boldBtn&quot;</span></span>
<span style="color: #000000;">                        label=<span style="color: #ff0000;">&quot;B&quot;</span></span>
<span style="color: #000000;">                        fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span></span>
<span style="color: #000000;">                        width=<span style="color: #ff0000;">&quot;30&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;boldBtn_clickHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ToggleButton</span> id=<span style="color: #ff0000;">&quot;italBtn&quot;</span></span>
<span style="color: #000000;">                        label=<span style="color: #ff0000;">&quot;I&quot;</span></span>
<span style="color: #000000;">                        fontStyle=<span style="color: #ff0000;">&quot;italic&quot;</span></span>
<span style="color: #000000;">                        width=<span style="color: #ff0000;">&quot;30&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;italBtn_clickHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ToggleButton</span> id=<span style="color: #ff0000;">&quot;underBtn&quot;</span></span>
<span style="color: #000000;">                        label=<span style="color: #ff0000;">&quot;U&quot;</span> </span>
<span style="color: #000000;">                        textDecoration=<span style="color: #ff0000;">&quot;underline&quot;</span></span>
<span style="color: #000000;">                        width=<span style="color: #ff0000;">&quot;30&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;underBtn_clickHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ToggleButton</span> id=<span style="color: #ff0000;">&quot;lineBtn&quot;</span></span>
<span style="color: #000000;">                        label=<span style="color: #ff0000;">&quot;S&quot;</span></span>
<span style="color: #000000;">                        lineThrough=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        width=<span style="color: #ff0000;">&quot;30&quot;</span></span>
<span style="color: #000000;">                        click=<span style="color: #ff0000;">&quot;lineBtn_clickHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColorPicker</span> id=<span style="color: #ff0000;">&quot;colorCP&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;colorCP_changeHandler(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ButtonBar</span> id=<span style="color: #ff0000;">&quot;txtAlignBB&quot;</span></span>
<span style="color: #000000;">                        arrowKeysWrapFocus=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        labelField=<span style="color: #ff0000;">&quot;label&quot;</span></span>
<span style="color: #000000;">                        width=<span style="color: #ff0000;">&quot;120&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;txtAlignBB_changeHandler(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ArrayList</span><span style="color: #7400FF;">&gt;</span></span>
                            <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Object</span> label=<span style="color: #ff0000;">&quot;L&quot;</span> value=<span style="color: #ff0000;">&quot;{TextAlign.LEFT}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                            <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Object</span> label=<span style="color: #ff0000;">&quot;C&quot;</span> value=<span style="color: #ff0000;">&quot;{TextAlign.CENTER}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                            <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Object</span> label=<span style="color: #ff0000;">&quot;R&quot;</span> value=<span style="color: #ff0000;">&quot;{TextAlign.RIGHT}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                            <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Object</span> label=<span style="color: #ff0000;">&quot;J&quot;</span> value=<span style="color: #ff0000;">&quot;{TextAlign.JUSTIFY}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:ArrayList</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:ButtonBar</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ToolBar</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ControlBar</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Panel</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_TextArea_setFormatOfRange_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_TextArea_setFormatOfRange_test/bin/main.html" width="100%" height="400"></iframe></p>
<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating a simple text editor using the Spark TextArea control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/07/24/creating-a-simple-text-editor-using-the-spark-textarea-control-in-flex-4/',contentID: 'post-1237',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'getFormatOfRange(),selectionActivePosition,selectionAnchorPosition,setFocus(),setFormatOfRange()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/07/24/creating-a-simple-text-editor-using-the-spark-textarea-control-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>Styling hyperlinks in a TextFlow object in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/06/28/styling-hyperlinks-in-a-textflow-object-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/06/28/styling-hyperlinks-in-a-textflow-object-in-flex-4/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 06:59:25 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta1]]></category>
		<category><![CDATA[TextArea (Spark)]]></category>
		<category><![CDATA[TextFlow]]></category>
		<category><![CDATA[TextFlowUtil]]></category>
		<category><![CDATA[format()]]></category>
		<category><![CDATA[importFromString()]]></category>
		<category><![CDATA[linkActiveFormat]]></category>
		<category><![CDATA[linkHoverFormat]]></category>
		<category><![CDATA[linkNormalFormat]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=1220</guid>
		<description><![CDATA[<p>The following example shows how you can style links in a TextFlow object in Flex 4 by specifying the linkNormalFormat, linkHoverFormat, and linkActiveFormat properties.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="">View MXML</a></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2009/06/28/styling-hyperlinks-in-a-textflow-object-in-flex-4/ --&#62; &#60;s:Application name=&#34;Spark_TextArea_textFlow_linkHoverFormat_test&#34; xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/halo&#34;&#62; &#160; &#60;fx:Script&#62; &#60;!&#91;CDATA&#91; import flashx.textLayout.formats.WhiteSpaceCollapse; import spark.utils.TextFlowUtil; &#160; XML.ignoreWhitespace = [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can style links in a TextFlow object in Flex 4 by specifying the <code>linkNormalFormat</code>, <code>linkHoverFormat</code>, and <code>linkActiveFormat</code> properties.</p>
<p>Full code after the jump.</p>
<p><span id="more-1220"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>
<p class="download"><a href="">View MXML</a></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/06/28/styling-hyperlinks-in-a-textflow-object-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_TextArea_textFlow_linkHoverFormat_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import flashx.textLayout.formats.WhiteSpaceCollapse;</span>
<span style="color: #000000;">            import spark.utils.TextFlowUtil;</span>
&nbsp;
<span style="color: #000000;">            XML.ignoreWhitespace = false;</span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:String</span> id=<span style="color: #ff0000;">&quot;markup&quot;</span> source=<span style="color: #ff0000;">&quot;teaserTextFlow.xml&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextArea</span> id=<span style="color: #ff0000;">&quot;txtArea&quot;</span></span>
<span style="color: #000000;">            textFlow=<span style="color: #ff0000;">&quot;{TextFlowUtil.importFromString(markup, WhiteSpaceCollapse.PRESERVE)}&quot;</span></span>
<span style="color: #000000;">            editable=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;400&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #000000;">            verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>And the TextFlow markup is as follows:</p>
<p class="download"><a href="">View teaserTextFlowxml</a></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/06/28/styling-hyperlinks-in-a-textflow-object-in-flex-4/ --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextFlow</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/textLayout/2008&quot;</span> <span style="color: #000066;">whiteSpaceCollapse</span>=<span style="color: #ff0000;">&quot;preserve&quot;</span> <span style="color: #000066;">fontSize</span>=<span style="color: #ff0000;">&quot;16&quot;</span> <span style="color: #000066;">paragraphSpaceAfter</span>=<span style="color: #ff0000;">&quot;15&quot;</span> <span style="color: #000066;">paddingTop</span>=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">paddingLeft</span>=<span style="color: #ff0000;">&quot;4&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;linkNormalFormat</span> <span style="color: #000066;">color</span>=<span style="color: #ff0000;">&quot;#0000ff&quot;</span> <span style="color: #000066;">textDecoration</span>=<span style="color: #ff0000;">&quot;underline&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;linkHoverFormat</span> <span style="color: #000066;">color</span>=<span style="color: #ff0000;">&quot;#ff0000&quot;</span> <span style="color: #000066;">textDecoration</span>=<span style="color: #ff0000;">&quot;underline&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;linkActiveFormat</span> <span style="color: #000066;">color</span>=<span style="color: #ff0000;">&quot;#ff00ff&quot;</span> <span style="color: #000066;">textDecoration</span>=<span style="color: #ff0000;">&quot;underline&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;format</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;code&quot;</span> <span style="color: #000066;">backgroundColor</span>=<span style="color: #ff0000;">&quot;#000000&quot;</span> <span style="color: #000066;">backgroundAlpha</span>=<span style="color: #ff0000;">&quot;0.1&quot;</span> <span style="color: #000066;">fontFamily</span>=<span style="color: #ff0000;">&quot;_typewriter&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p</span> <span style="color: #000066;">fontWeight</span>=<span style="color: #ff0000;">&quot;bold&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>The following excerpt is from <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://blog.flexexamples.com/&quot;</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;_self&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Flex Examples<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>The following example shows how you can import a TextFlow object from an XML object in Flex 4 by using the static <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;span</span> <span style="color: #000066;">format</span>=<span style="color: #ff0000;">&quot;code&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>TextFlowUtil.importFromXML()<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/span<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> method.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>For more information, see <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;http://blog.flexexamples.com/2009/06/25/importing-a-text-flow-from-an-xml-object-in-flex-4/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>&quot;Importing a text flow from an XML object in Flex 4&quot;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/TextFlow<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Styling hyperlinks in a TextFlow object in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/06/28/styling-hyperlinks-in-a-textflow-object-in-flex-4/',contentID: 'post-1220',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'format(),importFromString(),linkActiveFormat,linkHoverFormat,linkNormalFormat,TextFlow,TextFlowUtil',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/06/28/styling-hyperlinks-in-a-textflow-object-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Importing a text flow from an XML object in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/06/25/importing-a-text-flow-from-an-xml-object-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/06/25/importing-a-text-flow-from-an-xml-object-in-flex-4/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 06:59:35 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta1]]></category>
		<category><![CDATA[RichText (Spark)]]></category>
		<category><![CDATA[TextFlow]]></category>
		<category><![CDATA[TextFlowUtil]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[importFromXML()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/06/25/importing-a-text-flow-from-an-xml-object-in-flex-4/</guid>
		<description><![CDATA[<p>The following example shows how you can import a TextFlow object from an XML object in Flex 4 by using the static TextFlowUtil.importFromXML() method.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="">View MXML</a></p> &#60;?xml version=&#34;1.0&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2009/06/25/importing-a-text-flow-from-an-xml-object-in-flex-4/ --&#62; &#60;s:Application name=&#34;TextFlowUtil_importFromXML_test&#34; xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/halo&#34;&#62; &#160; &#60;fx:Script&#62; &#60;!&#91;CDATA&#91; import spark.utils.TextFlowUtil; &#160; XML.ignoreWhitespace = false; &#160; &#91;Bindable&#93; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can import a TextFlow object from an XML object in Flex 4 by using the static <code>TextFlowUtil.importFromXML()</code> method.</p>
<p>Full code after the jump.</p>
<p><span id="more-1147"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>
<p class="download"><a href="">View MXML</a></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/06/25/importing-a-text-flow-from-an-xml-object-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;TextFlowUtil_importFromXML_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import spark.utils.TextFlowUtil;</span>
&nbsp;
<span style="color: #000000;">            XML.ignoreWhitespace = false;</span>
&nbsp;
<span style="color: #000000;">            <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">            private var theXML:XML = &lt;div textAlign=<span style="color: #ff0000;">&quot;justify&quot;</span> paragraphSpaceBefore=<span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;">&lt;p<span style="color: #7400FF;">&gt;</span>&lt;span fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span><span style="color: #7400FF;">&gt;</span></span>Lorem ipsum dolor sit amet<span style="color: #000000;">&lt;/span<span style="color: #7400FF;">&gt;</span></span>, consectetur adipiscing elit. Sed vel lacus dignissim tellus lobortis pulvinar eget tempus dui. <span style="color: #000000;">&lt;span fontStyle=<span style="color: #ff0000;">&quot;italic&quot;</span><span style="color: #7400FF;">&gt;</span></span>Mauris et lacus velit, ac dictum augue.<span style="color: #000000;">&lt;/span<span style="color: #7400FF;">&gt;</span></span> Etiam non nisi eu nisl aliquet ullamcorper. Etiam pellentesque, purus vel pulvinar bibendum, libero orci pharetra erat, in dictum ipsum lacus in tortor. Suspendisse auctor, odio non ornare laoreet, diam dolor varius lacus, quis eleifend sem erat vel ipsum. Nunc tortor purus, suscipit eu semper ac, auctor nec lorem. Etiam tempor dignissim nisi, sed imperdiet quam dignissim et. In a neque mauris, at feugiat ante. Aliquam vel elit enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Praesent hendrerit dapibus turpis, ut euismod metus venenatis eget. Maecenas in orci nunc, nec consequat augue. Vestibulum egestas lacus vel risus faucibus tempor. Pellentesque purus tortor, sodales id tempus et, aliquet vel libero. Morbi dolor justo, feugiat at facilisis eget, mollis vel sem. Cras ut mi dui. Cras fringilla, dui pellentesque congue vehicula, felis nisl molestie turpis, ut eleifend arcu augue in magna. Nunc adipiscing mi ac urna laoreet aliquam pretium mauris sagittis. Quisque eu mi sit amet sem mollis tincidunt.<span style="color: #000000;">&lt;/p<span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;">&lt;p<span style="color: #7400FF;">&gt;</span></span>Cras nec mi tortor, id pretium sem. <span style="color: #000000;">&lt;span lineThrough=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>In hendrerit viverra orci quis condimentum.<span style="color: #000000;">&lt;/span<span style="color: #7400FF;">&gt;</span></span> Maecenas et arcu quis arcu volutpat consectetur quis vel tellus. <span style="color: #000000;">&lt;span color=<span style="color: #ff0000;">&quot;#FF0000&quot;</span><span style="color: #7400FF;">&gt;</span></span>Donec dapibus, est cursus convallis porta, dolor enim ullamcorper neque, eu aliquet elit risus at neque.<span style="color: #000000;">&lt;/span<span style="color: #7400FF;">&gt;</span></span> Proin eget tortor non velit pretium mattis eget vitae neque. Fusce sollicitudin odio at neque molestie et tempus est condimentum. Proin dignissim egestas egestas. Proin luctus, velit at ultricies aliquam, leo sapien tempor purus, tristique semper mauris velit ut turpis. Donec vestibulum mattis tellus, at molestie massa luctus vitae. Donec auctor, mi quis commodo condimentum, nisl sapien pharetra lorem, id venenatis felis sapien quis lacus. Cras dapibus, tortor porttitor varius vulputate, lorem elit auctor turpis, a consectetur enim magna eget mi. Sed dapibus volutpat semper. Sed rhoncus pulvinar semper. Etiam in mi nec massa venenatis cursus quis in massa. Quisque pulvinar nulla quis neque lobortis molestie. Phasellus ullamcorper cursus volutpat. Mauris dictum felis at est sodales tincidunt. Aliquam congue nibh vitae dolor dignissim ut tincidunt sem commodo. Sed sit amet turpis ac lectus molestie facilisis vitae at neque. Phasellus nec justo tortor.<span style="color: #000000;">&lt;/p<span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;">&lt;/div<span style="color: #7400FF;">&gt;</span></span>;
        ]]&gt;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:RichText</span> id=<span style="color: #ff0000;">&quot;richTxt&quot;</span></span>
<span style="color: #000000;">            textFlow=<span style="color: #ff0000;">&quot;{TextFlowUtil.importFromXML(theXML)}&quot;</span></span>
<span style="color: #000000;">            left=<span style="color: #ff0000;">&quot;20&quot;</span> right=<span style="color: #ff0000;">&quot;20&quot;</span></span>
<span style="color: #000000;">            verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Importing a text flow from an XML object in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/06/25/importing-a-text-flow-from-an-xml-object-in-flex-4/',contentID: 'post-1147',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'Gumbo,importFromXML(),RichText (Spark)',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/06/25/importing-a-text-flow-from-an-xml-object-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Globally styling anchor tags on a Spark RichEditableText control in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/03/17/globally-styling-anchor-tags-on-a-textview-control-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2009/03/17/globally-styling-anchor-tags-on-a-textview-control-in-flex-gumbo/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 06:29:40 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[RichEditableText]]></category>
		<category><![CDATA[TextFlow]]></category>
		<category><![CDATA[TextLayoutFormat]]></category>
		<category><![CDATA[defaultConfiguration]]></category>
		<category><![CDATA[defaultLinkActiveFormat]]></category>
		<category><![CDATA[defaultLinkHoverFormat]]></category>
		<category><![CDATA[defaultLinkNormalFormat]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[needsSWF]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/03/17/globally-styling-anchor-tags-on-a-textview-control-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can globally style the normal and hover states of a hyperlink on a Flex 4 Spark RichEditableText control by setting the static TextFlow.defaultConfiguration object.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2009/03/17/globally-styling-anchor-tags-on-a-textview-control-in-flex-gumbo/ --&#62; &#60;s:Application name=&#34;TextFlow_defaultConfiguration_test&#34; xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/halo&#34; preinitialize=&#34;init();&#34;&#62; &#160; &#60;fx:Script&#62; import flashx.textLayout.elements.Configuration; import flashx.textLayout.elements.TextFlow; import flashx.textLayout.formats.TextDecoration; import flashx.textLayout.formats.TextLayoutFormatValueHolder; &#160; private [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can globally style the normal and hover states of a hyperlink on a Flex 4 Spark RichEditableText control by setting the static <code>TextFlow.defaultConfiguration</code> object.</p>
<p><span id="more-1006"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/03/17/globally-styling-anchor-tags-on-a-textview-control-in-flex-gumbo/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;TextFlow_defaultConfiguration_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span></span>
<span style="color: #000000;">        preinitialize=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        import flashx.textLayout.elements.Configuration;
        import flashx.textLayout.elements.TextFlow;
        import flashx.textLayout.formats.TextDecoration;
        import flashx.textLayout.formats.TextLayoutFormatValueHolder;
&nbsp;
        private function init():void {
            var cfg:Configuration = TextFlow.defaultConfiguration;
&nbsp;
            var normalTLF:TextLayoutFormatValueHolder = new TextLayoutFormatValueHolder(cfg.defaultLinkNormalFormat);
            normalTLF.color = 0xFF0000;
&nbsp;
            var hoverTLF:TextLayoutFormatValueHolder = new TextLayoutFormatValueHolder(cfg.defaultLinkHoverFormat);
            hoverTLF.color = 0xFF00FF;
            hoverTLF.textDecoration = TextDecoration.NONE;
&nbsp;
            var activeTLF:TextLayoutFormatValueHolder = new TextLayoutFormatValueHolder(cfg.defaultLinkActiveFormat);
            activeTLF.color = 0x00FF00;
&nbsp;
            cfg.defaultLinkNormalFormat = normalTLF;
            cfg.defaultLinkHoverFormat = hoverTLF;
            cfg.defaultLinkActiveFormat = activeTLF;
            TextFlow.defaultConfiguration = cfg;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:RichEditableText</span> editable=<span style="color: #ff0000;">&quot;false&quot;</span> width=<span style="color: #ff0000;">&quot;300&quot;</span> horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:textFlow</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextFlow</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:p</span><span style="color: #7400FF;">&gt;</span></span>In addition to <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:a</span> href=<span style="color: #ff0000;">&quot;http://blog.flexexamples.com/&quot;</span><span style="color: #7400FF;">&gt;</span></span>FlexExamples.com<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:a</span><span style="color: #7400FF;">&gt;</span></span> you can check out my other mediocre blogs at <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:a</span> href=<span style="color: #ff0000;">&quot;http://actionscriptexamples.com/&quot;</span><span style="color: #7400FF;">&gt;</span></span>ActionScriptExamples.com<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:a</span><span style="color: #7400FF;">&gt;</span></span> and <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:a</span> href=<span style="color: #ff0000;">&quot;http://airexamples.com/&quot;</span><span style="color: #7400FF;">&gt;</span></span>AIRExamples.com<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:a</span><span style="color: #7400FF;">&gt;</span></span>.<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:p</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:TextFlow</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:textFlow</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:RichEditableText</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_RichEditableText_defaultConfiguration_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_RichEditableText_defaultConfiguration_test/bin/main.html" width="100%" height="100"></iframe></p>
<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Globally styling anchor tags on a Spark RichEditableText control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/03/17/globally-styling-anchor-tags-on-a-textview-control-in-flex-gumbo/',contentID: 'post-1006',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'defaultConfiguration,defaultLinkActiveFormat,defaultLinkHoverFormat,defaultLinkNormalFormat,Gumbo,needsSWF,TextLayoutFormat',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/03/17/globally-styling-anchor-tags-on-a-textview-control-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Looping over paragraphs in the FxTextArea control in Flex Gumbo</title>
		<link>http://blog.flexexamples.com/2008/12/06/looping-over-paragraphs-in-the-fxtextarea-control-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2008/12/06/looping-over-paragraphs-in-the-fxtextarea-control-in-flex-gumbo/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 06:19:39 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[FxTextArea]]></category>
		<category><![CDATA[TextFlow]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[export()]]></category>
		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/12/06/looping-over-paragraphs-in-the-fxtextarea-control-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can loop over the paragraphs in a Flex Gumbo FxTextArea control using the export() method and E4X.</p> <p>Full code after the jump.</p> <p></p> <p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can loop over the paragraphs in a Flex Gumbo FxTextArea control using the <code>export()</code> method and E4X.</p>
<p>Full code after the jump.</p>
<p><span id="more-889"></span></p>
<p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see <a href="http://blog.flexexamples.com/2008/08/02/using-the-beta-gumbo-sdk-in-flex-builder-3/">&#8220;Using the beta Gumbo SDK in Flex Builder 3&#8243;</a>.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FxTextArea_export_test/bin/srcview/source/main_4235.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/12/06/looping-over-paragraphs-in-the-fxtextarea-control-in-flex-gumbo/ --&gt;
&lt;Application name="FxTextArea_export_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;Script&gt;
        private function getParagraphs():void {
            var textFlowNS:Namespace = new Namespace("http://ns.adobe.com/textLayout/2008");

            var xml:XML = textArea.export();
            var xmlList:XMLList = xml.textFlowNS::p;
            var para:XML;
            for each (para in xmlList) {
                para.@color = getRandomColor();
            }
            textArea.content = xml;
        }

        private function getRandomColor():String {
            return "0x" + Math.round(Math.random() * 0xFFFFFF).toString(16);
        }
    &lt;/Script&gt;

    &lt;ApplicationControlBar dock="true"&gt;
        &lt;FxButton label="Randomize paragraph colors"
                click="getParagraphs();" /&gt;
    &lt;/ApplicationControlBar&gt;

    &lt;FxTextArea id="textArea" width="240" height="160"&gt;
        &lt;content&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
            &lt;p&gt;The quick brown fox jumped over the lazy dog.&lt;/p&gt;
        &lt;/content&gt;
    &lt;/FxTextArea&gt;

&lt;/Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/FxTextArea_export_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/FxTextArea_export_test/bin/main_4235.html" width="100%" height="300"></iframe></p>
<p class="alert">This entry is based on a beta version of the Flex Gumbo SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex Gumbo SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Looping over paragraphs in the FxTextArea control in Flex Gumbo on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/12/06/looping-over-paragraphs-in-the-fxtextarea-control-in-flex-gumbo/',contentID: 'post-889',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'content,export(),Gumbo',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/12/06/looping-over-paragraphs-in-the-fxtextarea-control-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

