<?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; transitions</title>
	<atom:link href="http://blog.flexexamples.com/tag/transitions/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>Fading an item renderer background fill on a Spark List control in Flex 4</title>
		<link>http://blog.flexexamples.com/2010/06/25/fading-an-item-renderer-background-fill-on-a-spark-list-control-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2010/06/25/fading-an-item-renderer-background-fill-on-a-spark-list-control-in-flex-4/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 22:12:20 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Flex4]]></category>
		<category><![CDATA[List (Spark)]]></category>
		<category><![CDATA[autoDrawBackground]]></category>
		<category><![CDATA[Fade]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[itemRenderer]]></category>
		<category><![CDATA[transitions]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=3196</guid>
		<description><![CDATA[<p>The following example shows how you can fade an item renderer background fill on a Spark List control in Flex 4 by creating a custom item renderer, setting the Boolean autoDrawBackground property to false, drawing your own background fill, and then setting a fade transition from the normal and hovered states.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can fade an item renderer background fill on a Spark List control in Flex 4 by creating a custom item renderer, setting the Boolean <code>autoDrawBackground</code> property to <em>false</em>, drawing your own background fill, and then setting a fade transition from the <em>normal</em> and <em>hovered</em> states.</p>
<p><span id="more-3196"></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/2010/06/25/fading-an-item-renderer-background-fill-on-a-spark-list-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_List_itemRenderer_fade_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/mx&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:List</span> id=<span style="color: #ff0000;">&quot;lst&quot;</span></span>
<span style="color: #000000;">            itemRenderer=<span style="color: #ff0000;">&quot;skins.FadingItemRenderer&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>
<span style="color: #000000;">                    horizontalAlign=<span style="color: #ff0000;">&quot;contentJustify&quot;</span></span>
<span style="color: #000000;">                    requestedRowCount=<span style="color: #ff0000;">&quot;7&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: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;[One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten]&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:List</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 custom Spark List item renderer, <em>skins/FadingItemRenderer.mxml</em>, 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/2010/06/25/fading-an-item-renderer-background-fill-on-a-spark-list-control-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:ItemRenderer</span> name=<span style="color: #ff0000;">&quot;FadingItemRenderer&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/mx&quot;</span></span>
<span style="color: #000000;">        autoDrawBackground=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:states</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;normal&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;hovered&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;selected&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:states</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:transitions</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Transition</span> fromState=<span style="color: #ff0000;">&quot;normal&quot;</span> toState=<span style="color: #ff0000;">&quot;hovered&quot;</span> autoReverse=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Fade</span> target=<span style="color: #ff0000;">&quot;{bgRect}&quot;</span> duration=<span style="color: #ff0000;">&quot;600&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Transition</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:transitions</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> id=<span style="color: #ff0000;">&quot;bgRect&quot;</span></span>
<span style="color: #000000;">            includeIn=<span style="color: #ff0000;">&quot;hovered,selected&quot;</span></span>
<span style="color: #000000;">            left=<span style="color: #ff0000;">&quot;0&quot;</span> right=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<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:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> color=<span style="color: #ff0000;">&quot;{getStyle('rollOverColor')}&quot;</span></span>
<span style="color: #000000;">                          color.selected=<span style="color: #ff0000;">&quot;{getStyle('selectionColor')}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;labelDisplay&quot;</span></span>
<span style="color: #000000;">            left=<span style="color: #ff0000;">&quot;5&quot;</span> right=<span style="color: #ff0000;">&quot;5&quot;</span> top=<span style="color: #ff0000;">&quot;5&quot;</span> bottom=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:ItemRenderer</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<div span="googleAdsLeaderboard">
<script type="text/javascript"><!--
google_ad_client = "pub-3325829455487492";
/* 728x90, created 7/15/09 */
google_ad_slot = "6403511741";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br />
</div>
<p class="information"><a href="http://dl.dropbox.com/u/4509565/FlexExamples_com/Spark_List_itemRenderer_fade_test/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://dl.dropbox.com/u/4509565/FlexExamples_com/Spark_List_itemRenderer_fade_test/main.html" width="100%" height="300"></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: 'Fading an item renderer background fill on a Spark List control in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2010/06/25/fading-an-item-renderer-background-fill-on-a-spark-list-control-in-flex-4/',contentID: 'post-3196',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'autoDrawBackground,Fade,Gumbo,itemRenderer,transitions',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/2010/06/25/fading-an-item-renderer-background-fill-on-a-spark-list-control-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting a fade transition on a Spark DropDownList component in Flex Gumbo</title>
		<link>http://blog.flexexamples.com/2009/04/28/setting-a-fade-transition-on-a-spark-dropdownlist-component-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2009/04/28/setting-a-fade-transition-on-a-spark-dropdownlist-component-in-flex-gumbo/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 06:59:25 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta1]]></category>
		<category><![CDATA[DropDownList]]></category>
		<category><![CDATA[DropDownList (Spark)]]></category>
		<category><![CDATA[Fade]]></category>
		<category><![CDATA[Transition]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[transitions]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2009/04/28/setting-a-fade-transition-on-a-spark-dropdownlist-component-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can fade in a Spark DropDownList pop up menu in Flex Gumbo by creating a custom DropDownList skin and setting the transitions property to a transition Fade effect.</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 [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can fade in a Spark DropDownList pop up menu in Flex Gumbo by creating a custom DropDownList skin and setting the <code>transitions</code> property to a transition Fade effect.</p>
<p>Full code after the jump.</p>
<p><span id="more-1062"></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/spark/Spark_DropDownList_transitions_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/2009/04/28/setting-a-fade-transition-on-a-spark-dropdownlist-component-in-flex-gumbo/ --&gt;
&lt;s:Application name="Spark_DropDownList_transitions_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:Declarations&gt;
        &lt;s:ArrayList id="arrList"
                source="[Red,Orange,Yellow,Green,Blue]" /&gt;
    &lt;/fx:Declarations&gt;

    &lt;s:DropDownList id="dropDownList"
            dataProvider="{arrList}"
            requiresSelection="true"
            skinClass="skins.CustomDropDownListSkin"
            horizontalCenter="0"
            top="20" /&gt;

&lt;/s:Application&gt;
</pre>
<p>The custom Spark DropDownList skin, CustomDropDownListSkin.mxml, is as follows:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_DropDownList_transitions_test/bin/srcview/source/skins/CustomDropDownListSkin.mxml.html">View skins/CustomDropDownListSkin.mxml</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2009/04/28/setting-a-fade-transition-on-a-spark-dropdownlist-component-in-flex-gumbo/ --&gt;
&lt;s:SparkSkin name=&quot;CustomDropDownListSkin&quot;
        xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
        xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
        alpha.disabled=&quot;0.5&quot;&gt;
    &lt;s:states&gt;
        &lt;s:State name=&quot;normal&quot; /&gt;
        &lt;s:State name=&quot;open&quot; /&gt;
        &lt;s:State name=&quot;disabled&quot; /&gt;
    &lt;/s:states&gt;
    <strong style="color:red;">&lt;s:transitions&gt;
        &lt;s:Transition fromState=&quot;normal&quot; toState=&quot;open&quot;&gt;
            &lt;s:Fade target=&quot;{popup}&quot; duration=&quot;3000&quot; /&gt;
        &lt;/s:Transition&gt;
    &lt;/s:transitions&gt;</strong>

    &lt;!-- host component --&gt;
    &lt;fx:Metadata&gt;
        &lt;![CDATA[
            [HostComponent(&quot;spark.components.DropDownList&quot;)]
        ]]&gt;
    &lt;/fx:Metadata&gt;

    &lt;!--- Defines the appearance of the DropDownList component's drop down area. --&gt;
    &lt;s:PopUp id=&quot;popup&quot;
            open.normal=&quot;false&quot; open.open=&quot;true&quot;
            includeIn=&quot;open&quot;
            left=&quot;0&quot; right=&quot;0&quot; top=&quot;0&quot; bottom=&quot;0&quot;
            visible.open=&quot;true&quot; visible.normal=&quot;false&quot;
            placement=&quot;below&quot;&gt;
        &lt;s:Group id=&quot;dropDown&quot;
                maxHeight=&quot;134&quot; minHeight=&quot;22&quot;
                visible.open=&quot;true&quot; visible.normal=&quot;false&quot;&gt;
            &lt;!-- border --&gt;
            &lt;s:Rect left=&quot;0&quot; right=&quot;0&quot; top=&quot;0&quot; bottom=&quot;0&quot;&gt;
                &lt;s:stroke&gt;
                    &lt;s:SolidColorStroke color=&quot;0x686868&quot; weight=&quot;1&quot;/&gt;
                &lt;/s:stroke&gt;
            &lt;/s:Rect&gt;

            &lt;!--- fill ---&gt;
            &lt;s:Rect id=&quot;background&quot; left=&quot;1&quot; right=&quot;1&quot; top=&quot;1&quot; bottom=&quot;1&quot; &gt;
                &lt;s:fill&gt;
                    &lt;s:SolidColor id=&quot;bgFill&quot; color=&quot;0xFFFFFF&quot; /&gt;
                &lt;/s:fill&gt;
            &lt;/s:Rect&gt;

            &lt;s:Scroller left=&quot;1&quot; top=&quot;1&quot; right=&quot;1&quot; bottom=&quot;1&quot; &gt;
                &lt;s:DataGroup id=&quot;dataGroup&quot; itemRenderer=&quot;spark.skins.default.DefaultItemRenderer&quot;&gt;
                    &lt;s:layout&gt;
                        &lt;s:VerticalLayout gap=&quot;0&quot; horizontalAlign=&quot;contentJustify&quot;/&gt;
                    &lt;/s:layout&gt;
                &lt;/s:DataGroup&gt;
            &lt;/s:Scroller&gt;

            &lt;s:filters&gt;
                &lt;s:DropShadowFilter blurX=&quot;20&quot; blurY=&quot;20&quot; distance=&quot;5&quot; angle=&quot;90&quot; alpha=&quot;0.6&quot; /&gt;
            &lt;/s:filters&gt;
        &lt;/s:Group&gt;
    &lt;/s:PopUp&gt;

    &lt;s:Button id=&quot;button&quot; left=&quot;0&quot; right=&quot;0&quot; top=&quot;0&quot; bottom=&quot;0&quot; focusEnabled=&quot;false&quot;
        skinClass=&quot;spark.skins.default.DropDownListButtonSkin&quot; /&gt;
    &lt;s:SimpleText id=&quot;labelElement&quot; verticalAlign=&quot;middle&quot;
        left=&quot;7&quot; right=&quot;30&quot; top=&quot;2&quot; bottom=&quot;2&quot; verticalCenter=&quot;1&quot; /&gt;

&lt;/s:SparkSkin&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_DropDownList_transitions_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_DropDownList_transitions_test/bin/main.html" width="100%" height="200"></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: 'Setting a fade transition on a Spark DropDownList component in Flex Gumbo on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/04/28/setting-a-fade-transition-on-a-spark-dropdownlist-component-in-flex-gumbo/',contentID: 'post-1062',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'Gumbo,transitions',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/04/28/setting-a-fade-transition-on-a-spark-dropdownlist-component-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Toggling a Flex container&#8217;s visibility using states</title>
		<link>http://blog.flexexamples.com/2007/08/24/toggling-a-flex-containers-visibility-using-states/</link>
		<comments>http://blog.flexexamples.com/2007/08/24/toggling-a-flex-containers-visibility-using-states/#comments</comments>
		<pubDate>Fri, 24 Aug 2007 14:10:36 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[AddChild]]></category>
		<category><![CDATA[Parallel]]></category>
		<category><![CDATA[States]]></category>
		<category><![CDATA[Transition]]></category>
		<category><![CDATA[VBox]]></category>
		<category><![CDATA[WipeDown]]></category>
		<category><![CDATA[currentState]]></category>
		<category><![CDATA[state]]></category>
		<category><![CDATA[transitions]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/24/toggling-a-flex-containers-visibility-using-states/</guid>
		<description><![CDATA[<p>In a previous post, <a href="http://blog.flexexamples.com/2007/08/23/toggling-a-flex-containers-visibility/">&#8220;Toggling a Flex container&#8217;s visibility&#8221;</a>, we looked at toggling a VBox container&#8217;s visibility by setting both the visible property and includeInLayout property. While the approach felt a little crude, we can build the same thing using the much more powerful view states. What are view states and how do we [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous post, <a href="http://blog.flexexamples.com/2007/08/23/toggling-a-flex-containers-visibility/">&#8220;Toggling a Flex container&#8217;s visibility&#8221;</a>, we looked at toggling a VBox container&#8217;s visibility by setting both the <code>visible</code> property and <code>includeInLayout</code> property. While the approach felt a little crude, we can build the same thing using the much more powerful view states. What are view states and how do we use them? Well, if you&#8217;re new to states, this should clear everything up: <a href="http://www.adobe.com/devnet/flex/quickstart/defining_state_transitions/">&#8220;Adobe &#8211; Flex Quick Start Basics: Creating States&#8221;</a>.</p>
<p>Now, with that out of the way, lets look at some code and a basic example.</p>
<p>Full code after the jump.</p>
<p><span id="more-118"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_states_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/08/24/toggling-a-flex-containers-visibility-using-states/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:transitions&gt;
        &lt;mx:Transition fromState="*" toState="*"&gt;
            &lt;mx:Parallel targets="{[vbox2]}"&gt;
                &lt;mx:WipeDown /&gt;
                &lt;mx:Fade /&gt;
            &lt;/mx:Parallel&gt;
        &lt;/mx:Transition&gt;
    &lt;/mx:transitions&gt;

    &lt;mx:states&gt;
        &lt;mx:State name="expanded"&gt;
            &lt;mx:AddChild relativeTo="{vbox1}" position="after"&gt;
                &lt;mx:VBox id="vbox2"
                        width="120"
                        height="100%"
                        backgroundColor="haloGreen"&gt;
                    &lt;mx:Label text="VBox 2" /&gt;
                &lt;/mx:VBox&gt;
            &lt;/mx:AddChild&gt;
        &lt;/mx:State&gt;
    &lt;/mx:states&gt;

    &lt;mx:Style&gt;
        VBox {
            paddingLeft: 10;
            paddingRight: 10;
            paddingTop: 10;
            paddingBottom: 10;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.effects.easing.*;

            [Bindable]
            [Embed(source="assets/help.png")]
            private var helpIcon:Class;

            private function toggleExpanded():void {
                switch (currentState) {
                    case "expanded":
                        currentState = "";
                        break;
                    default:
                        currentState = "expanded";
                        break;
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:HBox width="100%" height="100%"&gt;
        &lt;mx:VBox id="vbox1"
                width="120"
                height="100%"
                backgroundColor="haloOrange"&gt;
            &lt;mx:Label text="VBox 1" /&gt;
            &lt;mx:Button label="Help"
                       icon="{helpIcon}"
                    click="toggleExpanded()" /&gt;
        &lt;/mx:VBox&gt;

        &lt;mx:VBox id="vbox3"
                width="100%"
                height="100%"
                backgroundColor="haloBlue"&gt;
            &lt;mx:Label text="VBox 3" /&gt;
        &lt;/mx:VBox&gt;
    &lt;/mx:HBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_states_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/VBox_states_test/bin/main.html" width="100%" height="250"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Toggling a Flex container\&#039;s visibility using states on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/24/toggling-a-flex-containers-visibility-using-states/',contentID: 'post-118',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'currentState,state,transitions',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/2007/08/24/toggling-a-flex-containers-visibility-using-states/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

