<?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; Text</title>
	<atom:link href="http://blog.flexexamples.com/category/halo/text/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>Setting word wrapping on the Spark TextArea control in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/02/04/setting-word-wrapping-on-the-fxtextarea-control-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2009/02/04/setting-word-wrapping-on-the-fxtextarea-control-in-flex-gumbo/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 05:59:34 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[Text]]></category>
		<category><![CDATA[TextArea (Spark)]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[lineBreak]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/02/04/setting-word-wrapping-on-the-fxtextarea-control-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can set word wrapping on a Flex 4 Spark TextArea control by setting the lineBreak style to one of the static constants in the LineBreak class (flashx.textLayout.formats.LineBreak):</p> toFit (LineBreak.TO_FIT): For lines that wrap to fit to the container width. explicit (LineBreak.EXPLICIT): For lines that break only at explicit return/line [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set word wrapping on a Flex 4 Spark TextArea control by setting the <code>lineBreak</code> style to one of the static constants in the LineBreak class (flashx.textLayout.formats.LineBreak):</p>
<ul>
<li><strong>toFit</strong> (<code>LineBreak.TO_FIT</code>): For lines that wrap to fit to the container width.</li>
<li><strong>explicit</strong> (<code>LineBreak.EXPLICIT</code>): For lines that break only at explicit return/line feeds.</li>
</ul>
<p>Full code after the jump.</p>
<p><span id="more-953"></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>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/02/04/setting-word-wrapping-on-the-fxtextarea-control-in-flex-gumbo/ --&gt;
&lt;s:Application name="Spark_TextArea_lineBreak_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"&gt;

    &lt;mx:ApplicationControlBar cornerRadius="0" width="100%"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="lineBreak:"&gt;
                &lt;s:DropDownList id="comboBox" requiresSelection="true"&gt;
                    &lt;s:dataProvider&gt;
                        &lt;s:ArrayList source="[toFit,explicit]" /&gt;
                    &lt;/s:dataProvider&gt;
                &lt;/s:DropDownList&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;s:TextArea id="textArea"
            lineBreak="{comboBox.selectedItem}"
            fontSize="16"
            horizontalCenter="0"
            verticalCenter="0"&gt;
        &lt;s:content&gt;
            &lt;s:p&gt;1. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;2. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;3. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;4. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;5. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;6. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;7. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;8. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;9. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
        &lt;/s:content&gt;
    &lt;/s:TextArea&gt;

&lt;/s:Application&gt;
</pre>
<p>You can also set the <code>lineBreak</code> style in an external .CSS file or &lt;Style&gt; block, as seen in the following example:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/02/04/setting-word-wrapping-on-the-fxtextarea-control-in-flex-gumbo/ --&gt;
&lt;s:Application name="Spark_TextArea_lineBreak_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"&gt;

    &lt;fx:Style&gt;
        @namespace s "library://ns.adobe.com/flex/spark";

        s|TextArea {
            lineBreak: explicit;
        }
    &lt;/fx:Style&gt;

    &lt;s:TextArea id="textArea"
            fontSize="16"
            horizontalCenter="0"
            verticalCenter="0"&gt;
        &lt;s:content&gt;
            &lt;s:p&gt;1. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;2. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;3. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;4. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;5. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;6. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;7. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;8. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;9. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
        &lt;/s:content&gt;
    &lt;/s:TextArea&gt;

&lt;/s:Application&gt;
</pre>
<p>Or, you can set the <code>lineBreak</code> style using ActionScript, as seen in the following example:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/02/04/setting-word-wrapping-on-the-fxtextarea-control-in-flex-gumbo/ --&gt;
&lt;s:Application name="Spark_TextArea_lineBreak_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"&gt;
    &lt;fx:Script&gt;
        &lt;![CDATA[
            import mx.events.IndexChangedEvent;

            private function comboBox_selectionChanged(evt:IndexChangedEvent):void {
                textArea.setStyle("lineBreak", comboBox.selectedItem);
            }
        ]]&gt;
    &lt;/fx:Script&gt;

    &lt;mx:ApplicationControlBar cornerRadius="0" width="100%"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="lineBreak:"&gt;
                &lt;s:DropDownList id="comboBox"
                        requiresSelection="true"
                        selectionChanged="comboBox_selectionChanged(event);"&gt;
                    &lt;s:dataProvider&gt;
                        &lt;s:ArrayList source="[toFit,explicit]" /&gt;
                    &lt;/s:dataProvider&gt;
                &lt;/s:DropDownList&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;s:TextArea id="textArea"
            fontSize="16"
            horizontalCenter="0"
            verticalCenter="0"&gt;
        &lt;s:content&gt;
            &lt;s:p&gt;1. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;2. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;3. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;4. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;5. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;6. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;7. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;8. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
            &lt;s:p&gt;9. The quick brown fox jumps over the lazy dog.&lt;/s:p&gt;
        &lt;/s:content&gt;
    &lt;/s:TextArea&gt;

&lt;/s:Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/02/04/setting-word-wrapping-on-the-fxtextarea-control-in-flex-gumbo/ --&gt;
&lt;s:Application name="Spark_TextArea_lineBreak_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"
        initialize="init();"&gt;

    &lt;fx:Script&gt;
        &lt;![CDATA[
            import flashx.textLayout.formats.LineBreak;

            import mx.collections.ArrayList;
            import mx.containers.ApplicationControlBar;
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.events.IndexChangedEvent;
            import spark.components.DropDownList;
            import spark.components.TextArea;

            private var comboBox:DropDownList;
            private var textArea:TextArea;

            private function init():void {
                var arr:Array = [LineBreak.TO_FIT, LineBreak.EXPLICIT];

                comboBox = new DropDownList();
                comboBox.dataProvider = new ArrayList(arr);
                comboBox.requiresSelection = true;
                comboBox.addEventListener(IndexChangedEvent.SELECTION_CHANGED, comboBox_change);

                var formItem:FormItem = new FormItem();
                formItem.label = "lineBreak:";
                formItem.addChild(comboBox);

                var form:Form = new Form();
                form.styleName = "plain";
                form.addChild(formItem);

                var appControlBar:ApplicationControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.percentWidth = 100;
                appControlBar.setStyle("cornerRadius", 0);
                appControlBar.addChild(form);
                addElementAt(appControlBar, 0);

                var c:XML = &lt;TextFlow xmlns="http://ns.adobe.com/textLayout/2008"&gt;
                        &lt;p&gt;1. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
                        &lt;p&gt;2. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
                        &lt;p&gt;3. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
                        &lt;p&gt;4. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
                        &lt;p&gt;5. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
                        &lt;p&gt;6. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
                        &lt;p&gt;7. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
                        &lt;p&gt;8. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
                        &lt;p&gt;9. The quick brown fox jumps over the lazy dog.&lt;/p&gt;
                    &lt;/TextFlow&gt;;

                textArea = new TextArea();
                textArea.content = c;
                textArea.setStyle("fontSize", 16);
                textArea.horizontalCenter = 0;
                textArea.verticalCenter = 0;
                addElement(textArea);
            }

            private function comboBox_change(evt:IndexChangedEvent):void {
                textArea.setStyle("lineBreak", comboBox.selectedItem);
            }
        ]]&gt;
    &lt;/fx:Script&gt;

&lt;/s:Application&gt;
</pre>
<p>Also, if you were using plain text instead of HTML formatted text (using the &lt;p&gt; and/or &lt;br&gt; tags) you would set the <code>text</code> property and use the &#8220;\n&#8221; escape sequence to create new lines, as seen in the following example:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2009/02/04/setting-word-wrapping-on-the-fxtextarea-control-in-flex-gumbo/ --&gt;
&lt;s:Application name="Spark_TextArea_lineBreak_test"
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo"
        initialize="init();"&gt;

    &lt;fx:Script&gt;
        &lt;![CDATA[
            import flashx.textLayout.formats.LineBreak;

            import mx.collections.ArrayList;
            import mx.containers.ApplicationControlBar;
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.events.IndexChangedEvent;
            import spark.components.DropDownList;
            import spark.components.TextArea;

            private var comboBox:DropDownList;
            private var textArea:TextArea;

            private function init():void {
                var arr:Array = [LineBreak.TO_FIT, LineBreak.EXPLICIT];

                comboBox = new DropDownList();
                comboBox.dataProvider = new ArrayList(arr);
                comboBox.requiresSelection = true;
                comboBox.addEventListener(IndexChangedEvent.SELECTION_CHANGED, comboBox_change);

                var formItem:FormItem = new FormItem();
                formItem.label = "lineBreak:";
                formItem.addChild(comboBox);

                var form:Form = new Form();
                form.styleName = "plain";
                form.addChild(formItem);

                var appControlBar:ApplicationControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.percentWidth = 100;
                appControlBar.setStyle("cornerRadius", 0);
                appControlBar.addChild(form);
                addElementAt(appControlBar, 0);

                var c:String = "1. The quick brown fox jumps over the lazy dog.\\n" +
                        "2. The quick brown fox jumps over the lazy dog.\\n" +
                        "3. The quick brown fox jumps over the lazy dog.\\n" +
                        "4. The quick brown fox jumps over the lazy dog.\\n" +
                        "5. The quick brown fox jumps over the lazy dog.\\n" +
                        "6. The quick brown fox jumps over the lazy dog.\\n" +
                        "7. The quick brown fox jumps over the lazy dog.\\n" +
                        "8. The quick brown fox jumps over the lazy dog.\\n" +
                        "9. The quick brown fox jumps over the lazy dog.";

                textArea = new TextArea();
                textArea.text = c;
                textArea.setStyle("fontSize", 16);
                textArea.horizontalCenter = 0;
                textArea.verticalCenter = 0;
                addElement(textArea);
            }

            private function comboBox_change(evt:IndexChangedEvent):void {
                textArea.setStyle("lineBreak", comboBox.selectedItem);
            }
        ]]&gt;
    &lt;/fx:Script&gt;

&lt;/s:Application&gt;
</pre>
<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: 'Setting word wrapping on the Spark TextArea control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/02/04/setting-word-wrapping-on-the-fxtextarea-control-in-flex-gumbo/',contentID: 'post-953',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'content,Gumbo,lineBreak',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/02/04/setting-word-wrapping-on-the-fxtextarea-control-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Setting the leading on a Text control in Flex</title>
		<link>http://blog.flexexamples.com/2008/05/31/setting-the-leading-on-a-text-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/05/31/setting-the-leading-on-a-text-control-in-flex/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 04:24:43 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Text]]></category>
		<category><![CDATA[leading]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/05/31/setting-the-leading-on-a-text-control-in-flex/</guid>
		<description><![CDATA[<p>The following examples show how you can set the text leading (additional vertical space between lines of text) on a Flex Text control by setting the leading style using MXML, CSS or ActionScript.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Text_leading_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/05/31/setting-the-leading-on-a-text-control-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top" backgroundColor="white"&#62; &#60;mx:Script&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following examples show how you can set the text leading (additional vertical space between lines of text) on a Flex Text control by setting the <code>leading</code> style using MXML, CSS or ActionScript.</p>
<p>Full code after the jump.</p>
<p><span id="more-652"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Text_leading_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/05/31/setting-the-leading-on-a-text-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function init():void {
                slider.value = txt.getStyle("leading");
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:String id="lorem" source="lorem.txt" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="leading:" direction="horizontal"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="0"
                        maximum="10"
                        snapInterval="1"
                        tickInterval="1"
                        liveDragging="true" /&gt;
                &lt;mx:Label text="{slider.value}" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="height:"&gt;
                &lt;mx:Label text="{txt.height}" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Text id="txt"
            text="{lorem}"
            leading="{slider.value}"
            textAlign="justify"
            width="400"
            preinitialize="init();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Text_leading_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/Text_leading_test/bin/main.html" width="100%" height="400"></iframe></p>
<p>You can also set the <code>leading</code> style using an external .CSS file or &lt;mx:Style /&gt; block, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Text_leading_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/05/31/setting-the-leading-on-a-text-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        Text {
            leading: 12;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function init():void {
                lbl.text = txt.getStyle("leading");
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:String id="lorem" source="lorem.txt" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="leading:"&gt;
                &lt;mx:Label id="lbl" creationComplete="init();" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="height:"&gt;
                &lt;mx:Label text="{txt.height}" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Text id="txt"
            text="{lorem}"
            textAlign="justify"
            width="400" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>leading</code> style using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Text_leading_test/bin/srcview/source/main3.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/05/31/setting-the-leading-on-a-text-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.SliderEvent;

            private function init():void {
                slider.value = txt.getStyle("leading");
            }

            private function slider_change(evt:SliderEvent):void {
                txt.setStyle("leading", evt.value);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:String id="lorem" source="lorem.txt" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="leading:" direction="horizontal"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="0"
                        maximum="10"
                        snapInterval="1"
                        tickInterval="1"
                        liveDragging="true"
                        change="slider_change(event);" /&gt;
                &lt;mx:Label text="{slider.value}" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="height:"&gt;
                &lt;mx:Label text="{txt.height}" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Text id="txt"
            text="{lorem}"
            textAlign="justify"
            width="400"
            preinitialize="init();" /&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the leading on a Text control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/05/31/setting-the-leading-on-a-text-control-in-flex/',contentID: 'post-652',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'leading',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/05/31/setting-the-leading-on-a-text-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

