<?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; leading</title>
	<atom:link href="http://blog.flexexamples.com/tag/leading/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 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>

