<?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; VBox</title>
	<atom:link href="http://blog.flexexamples.com/category/halo/vbox/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>Displaying a drop shadow behind a VBox container in Flex</title>
		<link>http://blog.flexexamples.com/2008/09/24/displaying-a-drop-shadow-behind-a-vbox-container-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/09/24/displaying-a-drop-shadow-behind-a-vbox-container-in-flex/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 06:31:10 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[VBox]]></category>
		<category><![CDATA[borderStyle]]></category>
		<category><![CDATA[borderThickness]]></category>
		<category><![CDATA[dropShadowEnabled]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/24/displaying-a-drop-shadow-behind-a-vbox-container-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can display a drop shadow behind a Flex VBox container by setting the borderStyle and dropShadowEnabled styles.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_dropShadowEnabled_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/09/24/displaying-a-drop-shadow-behind-a-vbox-container-in-flex/ --&#62; &#60;mx:Application name="VBox_dropShadowEnabled_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:VBox id="vBox" dropShadowEnabled="true" borderStyle="solid" borderThickness="0" backgroundColor="red" width="100%" height="100%"&#62; &#60;mx:Label text="{Capabilities.version}" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can display a drop shadow behind a Flex VBox container by setting the <code>borderStyle</code> and <code>dropShadowEnabled</code> styles.</p>
<p>Full code after the jump.</p>
<p><span id="more-805"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_dropShadowEnabled_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/09/24/displaying-a-drop-shadow-behind-a-vbox-container-in-flex/ --&gt;
&lt;mx:Application name="VBox_dropShadowEnabled_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:VBox id="vBox"
            dropShadowEnabled="true"
            borderStyle="solid"
            borderThickness="0"
            backgroundColor="red"
            width="100%"
            height="100%"&gt;
        &lt;mx:Label text="{Capabilities.version}"
                fontSize="64" /&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_dropShadowEnabled_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_dropShadowEnabled_test/bin/main.html" width="100%" height="200"></iframe></p>
<p>You can also set the <code>borderStyle</code> and <code>dropShadowEnabled</code> styles in 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/VBox_dropShadowEnabled_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/09/24/displaying-a-drop-shadow-behind-a-vbox-container-in-flex/ --&gt;
&lt;mx:Application name="VBox_dropShadowEnabled_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        VBox {
            dropShadowEnabled: true;
            borderStyle: solid;
            borderThickness: 0;
            backgroundColor: red;
        }
    &lt;/mx:Style&gt;

    &lt;mx:VBox id="vBox"
            width="100%"
            height="100%"&gt;
        &lt;mx:Label text="{Capabilities.version}"
                fontSize="64" /&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>borderStyle</code> and <code>dropShadowEnabled</code> styles using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_dropShadowEnabled_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/09/24/displaying-a-drop-shadow-behind-a-vbox-container-in-flex/ --&gt;
&lt;mx:Application name="VBox_dropShadowEnabled_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function init():void {
                vBox.setStyle("dropShadowEnabled", true);
                vBox.setStyle("borderStyle", "solid");
                vBox.setStyle("borderThickness", 0);
                vBox.setStyle("backgroundColor", "red");
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:VBox id="vBox"
            width="100%"
            height="100%"
            initialize="init();"&gt;
        &lt;mx:Label text="{Capabilities.version}"
                fontSize="64" /&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_dropShadowEnabled_test/bin/srcview/source/main4.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/24/displaying-a-drop-shadow-behind-a-vbox-container-in-flex/ --&gt;
&lt;mx:Application name="VBox_dropShadowEnabled_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Label;
            import mx.containers.VBox;

            private var vBox:VBox;

            private function init():void {
                var lbl:Label = new Label();
                lbl.text = Capabilities.version;
                lbl.setStyle("fontSize", 64);

                vBox = new VBox();
                vBox.setStyle("dropShadowEnabled", true);
                vBox.setStyle("borderStyle", "solid");
                vBox.setStyle("borderThickness", 0);
                vBox.setStyle("backgroundColor", "red");
                vBox.percentWidth = 100;
                vBox.percentHeight = 100;
                vBox.addChild(lbl);
                addChild(vBox);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Displaying a drop shadow behind a VBox container in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/09/24/displaying-a-drop-shadow-behind-a-vbox-container-in-flex/',contentID: 'post-805',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'borderStyle,borderThickness,dropShadowEnabled',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/09/24/displaying-a-drop-shadow-behind-a-vbox-container-in-flex/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting effects with ActionScript in Flex</title>
		<link>http://blog.flexexamples.com/2008/02/27/setting-effects-with-actionscript-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/02/27/setting-effects-with-actionscript-in-flex/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 03:55:23 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Effects]]></category>
		<category><![CDATA[Fade]]></category>
		<category><![CDATA[Rotate]]></category>
		<category><![CDATA[VBox]]></category>
		<category><![CDATA[hideEffect]]></category>
		<category><![CDATA[showEffect]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/02/27/setting-effects-with-actionscript-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set effects on a Flex Image control using ActionScript by setting the showEffect and hideEffect effects using the setStyle() method.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_showEffect_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/02/27/setting-effects-with-actionscript-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" creationComplete="init();"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.effects.easing.*; private function [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set effects on a Flex Image control using ActionScript by setting the <code>showEffect</code> and <code>hideEffect</code> effects using the setStyle() method.</p>
<p>Full code after the jump.</p>
<p><span id="more-532"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_showEffect_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/02/27/setting-effects-with-actionscript-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init();"&gt;

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

            private function init():void {
                img.setStyle("showEffect", rotate);
                img.setStyle("hideEffect", fade);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Fade id="fade" /&gt;
    &lt;mx:Rotate id="rotate"
            angleFrom="-180"
            angleTo="0"
            easingFunction="Elastic.easeInOut"
            duration="2000" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="visible:"&gt;
                &lt;mx:ToggleButtonBar id="toggleButtonBar"
                        itemClick="img.visible = event.item.data;"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="Show" data="true" /&gt;
                            &lt;mx:Object label="Hide" data="false" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ToggleButtonBar&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Image id="img"
            source="@Embed('assets/flashplayer_icon.jpg')"
            width="100"
            height="100" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_showEffect_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_showEffect_test/bin/main.html" width="100%" height="200"></iframe></p>
<p>Or, you can also create the effect using ActionScript instead of MXML, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_showEffect_test_2/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/02/27/setting-effects-with-actionscript-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init();"&gt;

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

            private var fade:Fade;
            private var rotate:Rotate;

            private function init():void {
                // Fade effect
                fade = new Fade();
                // Rotate effect
                rotate = new Rotate();
                rotate.angleFrom = -180;
                rotate.angleTo = 0;
                rotate.easingFunction = Elastic.easeInOut;
                rotate.duration = 2000;

                img.setStyle("showEffect", rotate);
                img.setStyle("hideEffect", fade);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="visible:"&gt;
                &lt;mx:ToggleButtonBar id="toggleButtonBar"
                        itemClick="img.visible = event.item.data;"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="Show" data="true" /&gt;
                            &lt;mx:Object label="Hide" data="false" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ToggleButtonBar&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Image id="img"
            source="@Embed('assets/flashplayer_icon.jpg')"
            width="100"
            height="100" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_showEffect_test_2/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_showEffect_test_2/bin/main.html" width="100%" height="200"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting effects with ActionScript in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/02/27/setting-effects-with-actionscript-in-flex/',contentID: 'post-532',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'hideEffect,showEffect',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/02/27/setting-effects-with-actionscript-in-flex/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Clipping a Flex container&#8217;s content using the clipContent property</title>
		<link>http://blog.flexexamples.com/2008/02/02/clipping-a-flex-containers-content-using-the-clipcontent-property/</link>
		<comments>http://blog.flexexamples.com/2008/02/02/clipping-a-flex-containers-content-using-the-clipcontent-property/#comments</comments>
		<pubDate>Sun, 03 Feb 2008 01:42:03 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Box]]></category>
		<category><![CDATA[Container]]></category>
		<category><![CDATA[HBox]]></category>
		<category><![CDATA[VBox]]></category>
		<category><![CDATA[clipContent]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/02/02/clipping-a-flex-containers-content-using-the-clipcontent-property/</guid>
		<description><![CDATA[<p>The following example shows how you can clip a container&#8217;s content in Flex by setting the clipContent property.<br /> According to the Flex 3 documentation for the Container class&#8217;s clipContent property:</p> <p> Whether to apply a clip mask if the positions and/or sizes of this container&#8217;s children extend outside the borders of this container. If [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can clip a container&#8217;s content in Flex by setting the clipContent property.<br />
According to the Flex 3 documentation for the Container class&#8217;s <code>clipContent</code> property:</p>
<blockquote><p>
Whether to apply a clip mask if the positions and/or sizes of this container&#8217;s children extend outside the borders of this container. If <code>false</code>, the children of this container remain visible when they are moved or sized outside the borders of this container. If <code>true</code>, the children of this container are clipped.<br />
If <code>clipContent</code> is <code>false</code>, then scrolling is disabled for this container and scrollbars will not appear. If <code>clipContent</code> is <code>true</code>, then scrollbars will usually appear when the container&#8217;s children extend outside the border of the container.<br />
The default value is <code>true</code>.
</p></blockquote>
<p><span id="more-508"></span></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/2008/02/02/clipping-a-flex-containers-content-using-the-clipcontent-property/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;Box_clipContent_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ApplicationControlBar</span> dock=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:CheckBox</span> id=<span style="color: #ff0000;">&quot;checkBox&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;clipContent:&quot;</span></span>
<span style="color: #000000;">                labelPlacement=<span style="color: #ff0000;">&quot;left&quot;</span></span>
<span style="color: #000000;">                selected=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ApplicationControlBar</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Box</span> id=<span style="color: #ff0000;">&quot;box&quot;</span></span>
<span style="color: #000000;">            clipContent=<span style="color: #ff0000;">&quot;{checkBox.selected}&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;320&quot;</span></span>
<span style="color: #000000;">            height=<span style="color: #ff0000;">&quot;240&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Image</span> id=<span style="color: #ff0000;">&quot;img&quot;</span></span>
<span style="color: #000000;">                source=<span style="color: #ff0000;">&quot;http://www.helpexamples.com/flash/images/image1.jpg&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Box</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> text=<span style="color: #ff0000;">&quot;{img.width} x {img.height}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Box_clipContent_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/Box_clipContent_test/bin/main.html" width="100%" height="400"></iframe></p>
<p>As you can see, the Box container is set to 320 pixels wide by 240 pixels high. The image being loaded is 400 pixels high by 267 pixels wide. When the <code>clipContent</code> property is set to <code>false</code>, the image exceeds the bounds of the Box container causing it to overlap the Label control. If you set the <code>clipContent</code> property to <code>true</code>, the image doesn&#8217;t exceed the bounds of the Box container and horizontal and vertical scroll bars appear, allowing you to scroll to see the rest of the content.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Clipping a Flex container\&#039;s content using the clipContent property on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/02/02/clipping-a-flex-containers-content-using-the-clipcontent-property/',contentID: 'post-508',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'clipContent',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/02/02/clipping-a-flex-containers-content-using-the-clipcontent-property/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Changing a VBox container&#8217;s background size in Flex</title>
		<link>http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-size-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-size-in-flex/#comments</comments>
		<pubDate>Sat, 05 Jan 2008 22:17:07 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[VBox]]></category>
		<category><![CDATA[backgroundImage]]></category>
		<category><![CDATA[backgroundSize]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-size-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set a background image and background size for a Flex VBox container by setting the backgroundImage, and backgroundSize styles.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_backgroundSize_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-size-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; VBox { backgroundImage: Embed("Fx.png"); backgroundColor: red; } [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set a background image and background size for a Flex VBox container by setting the <code>backgroundImage</code>, and <code>backgroundSize</code> styles.</p>
<p>Full code after the jump.</p>
<p><span id="more-426"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_backgroundSize_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-size-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        VBox {
            backgroundImage: Embed("Fx.png");
            backgroundColor: red;
        }
    &lt;/mx:Style&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="percentWidth:"&gt;
                &lt;mx:HSlider id="sliderW"
                        minimum="0"
                        maximum="100"
                        value="100"
                        liveDragging="true"
                        snapInterval="1"
                        tickInterval="10"
                        dataTipPrecision="0" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="percentHeight:"&gt;
                &lt;mx:HSlider id="sliderH"
                        minimum="0"
                        maximum="100"
                        value="100"
                        liveDragging="true"
                        snapInterval="1"
                        tickInterval="10"
                        dataTipPrecision="0" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="backgroundSize:"&gt;
                &lt;mx:ComboBox id="comboBox"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="auto" /&gt;
                            &lt;mx:Object label="100%" /&gt;
                            &lt;mx:Object label="90%" /&gt;
                            &lt;mx:Object label="80%" /&gt;
                            &lt;mx:Object label="70%" /&gt;
                            &lt;mx:Object label="60%" /&gt;
                            &lt;mx:Object label="50%" /&gt;
                            &lt;mx:Object label="40%" /&gt;
                            &lt;mx:Object label="30%" /&gt;
                            &lt;mx:Object label="20%" /&gt;
                            &lt;mx:Object label="10%" /&gt;
                            &lt;mx:Object label="0%" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ComboBox&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:HBox percentWidth="{sliderW.value}"
            percentHeight="{sliderH.value}"&gt;
        &lt;mx:VBox backgroundSize="{comboBox.selectedItem.label}"
                width="100%"
                height="100%" /&gt;
    &lt;/mx:HBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_backgroundSize_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_backgroundSize_test/bin/main.html" width="100%" height="450"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Changing a VBox container\&#039;s background size in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-size-in-flex/',contentID: 'post-426',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'backgroundImage,backgroundSize',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/01/05/changing-a-vbox-containers-background-size-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing a VBox container&#8217;s background alpha in Flex</title>
		<link>http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-alpha-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-alpha-in-flex/#comments</comments>
		<pubDate>Sat, 05 Jan 2008 22:01:09 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[VBox]]></category>
		<category><![CDATA[backgroundAlpha]]></category>
		<category><![CDATA[backgroundColor]]></category>
		<category><![CDATA[backgroundImage]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-alpha-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set both an background image and background color and change its alpha to for a Flex VBox container by setting the backgroundImage, backgroundColor, and backgroundAlpha styles.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-alpha-in-flex/ --&#62; &#60;mx:Application xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#160; &#60;mx:Style&#62; .containerVBox { backgroundColor: haloBlue; borderThickness: 1; borderColor: black; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set both an background image and background color and change its alpha to for a Flex VBox container by setting the <code>backgroundImage</code>, <code>backgroundColor</code>, and <code>backgroundAlpha</code> styles.</p>
<p><span id="more-425"></span></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/2008/01/05/changing-a-vbox-containers-background-alpha-in-flex/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        .containerVBox {
            backgroundColor: haloBlue;
            borderThickness: 1;
            borderColor: black;
            borderStyle: solid;
            paddingLeft: 5;
            paddingRight: 5;
            paddingTop: 5;
            paddingBottom: 5;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            [Bindable]</span>
<span style="color: #339933;">            [Embed(&quot;Fx.png&quot;)]</span>
<span style="color: #339933;">            private var flexLogo:Class;</span>
&nbsp;
<span style="color: #339933;">            private function backImage_change(evt:Event):void {</span>
<span style="color: #339933;">                if (backImage.selected) {</span>
<span style="color: #339933;">                    vBox.setStyle(&quot;backgroundImage&quot;, flexLogo);</span>
<span style="color: #339933;">                } else {</span>
<span style="color: #339933;">                    vBox.setStyle(&quot;backgroundImage&quot;, null);</span>
<span style="color: #339933;">                }</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function backColor_change(evt:Event):void {</span>
<span style="color: #339933;">                if (backColor.selected) {</span>
<span style="color: #339933;">                    vBox.setStyle(&quot;backgroundColor&quot;, colorPicker.selectedColor);</span>
<span style="color: #339933;">                } else {</span>
<span style="color: #339933;">                    vBox.setStyle(&quot;backgroundColor&quot;, null);</span>
<span style="color: #339933;">                }</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:String</span> id=<span style="color: #ff0000;">&quot;lorem&quot;</span> source=<span style="color: #ff0000;">&quot;lorem.txt&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ApplicationControlBar</span> dock=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Form</span> styleName=<span style="color: #ff0000;">&quot;plain&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;backgroundAlpha:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:HSlider</span> id=<span style="color: #ff0000;">&quot;slider&quot;</span></span>
<span style="color: #000000;">                        minimum=<span style="color: #ff0000;">&quot;0.0&quot;</span></span>
<span style="color: #000000;">                        maximum=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #000000;">                        value=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #000000;">                        liveDragging=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        tickInterval=<span style="color: #ff0000;">&quot;0.1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;show backgroundImage:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:CheckBox</span> id=<span style="color: #ff0000;">&quot;backImage&quot;</span></span>
<span style="color: #000000;">                        selected=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;backImage_change(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;show backgroundColor:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:CheckBox</span> id=<span style="color: #ff0000;">&quot;backColor&quot;</span></span>
<span style="color: #000000;">                        selected=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;backColor_change(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;backgroundColor:&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;colorPicker&quot;</span></span>
<span style="color: #000000;">                        selectedColor=<span style="color: #ff0000;">&quot;white&quot;</span></span>
<span style="color: #000000;">                        enabled=<span style="color: #ff0000;">&quot;{backColor.selected}&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;backColor_change(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ApplicationControlBar</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VBox</span> styleName=<span style="color: #ff0000;">&quot;containerVBox&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VBox</span> id=<span style="color: #ff0000;">&quot;vBox&quot;</span></span>
<span style="color: #000000;">                backgroundImage=<span style="color: #ff0000;">&quot;{flexLogo}&quot;</span></span>
<span style="color: #000000;">                backgroundAlpha=<span style="color: #ff0000;">&quot;{slider.value}&quot;</span></span>
<span style="color: #000000;">                backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span></span>
<span style="color: #000000;">                backgroundAttachment=<span style="color: #ff0000;">&quot;fixed&quot;</span></span>
<span style="color: #000000;">                width=<span style="color: #ff0000;">&quot;500&quot;</span></span>
<span style="color: #000000;">                height=<span style="color: #ff0000;">&quot;250&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Text</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> text=<span style="color: #ff0000;">&quot;{lorem}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_backgroundAlpha_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_backgroundAlpha_test/bin/main.html" width="100%" height="450"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Changing a VBox container\&#039;s background alpha in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-alpha-in-flex/',contentID: 'post-425',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'backgroundAlpha,backgroundColor,backgroundImage',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/01/05/changing-a-vbox-containers-background-alpha-in-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Changing a VBox container&#8217;s background image attachment in Flex</title>
		<link>http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-image-attachment-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-image-attachment-in-flex/#comments</comments>
		<pubDate>Sat, 05 Jan 2008 21:35:31 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[VBox]]></category>
		<category><![CDATA[backgroundAttachment]]></category>
		<category><![CDATA[backgroundImage]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-image-attachment-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set a background image and change its attachment to scrolling or fixed for a Flex VBox container by setting the backgroundImage and backgroundAttachment styles.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_backgroundAttachment_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-image-attachment-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; .containerVBox { [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set a background image and change its attachment to scrolling or fixed for a Flex VBox container by setting the <code>backgroundImage</code> and <code>backgroundAttachment</code> styles.</p>
<p>Full code after the jump.</p>
<p><span id="more-417"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_backgroundAttachment_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-image-attachment-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        .containerVBox {
            backgroundColor: white;
            borderThickness: 1;
            borderColor: black;
            borderStyle: solid;
            paddingLeft: 5;
            paddingRight: 5;
            paddingTop: 5;
            paddingBottom: 5;
        }
    &lt;/mx:Style&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="backgroundAttachment:"&gt;
                &lt;mx:ComboBox id="comboBox"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Array&gt;
                            &lt;mx:Object label="scroll" /&gt;
                            &lt;mx:Object label="fixed" /&gt;
                        &lt;/mx:Array&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ComboBox&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:VBox styleName="containerVBox"&gt;
        &lt;mx:VBox id="vBox"
                backgroundImage="@Embed('Fx.png')"
                backgroundAttachment="{comboBox.selectedItem.label}"
                width="500"
                height="250"&gt;
            &lt;mx:Text width="100%" text="{lorem}" /&gt;
        &lt;/mx:VBox&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_backgroundAttachment_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_backgroundAttachment_test/bin/main.html" width="100%" height="350"></iframe></p>
<p>If you want to set the <code>backgroundImage</code> and <code>backgroundAttachment</code> styles using an external .CSS file or &lt;mx:Style /&gt; block, you can use code similar to the following snippet:</p>
<pre class="code">
&lt;mx:Style&gt;
    VBox {
        backgroundImage: Embed("Fx.png");
        backgroundAttachment: fixed;
    }
&lt;/mx:Style&gt;
</pre>
<p>Or, if you want to set the <code>backgroundImage</code> and <code>backgroundAttachment</code> styles using ActionScript, you can use code similar to the following snippet:</p>
<pre class="code">
&lt;mx:Script&gt;
    &lt;![CDATA[
        private function vBox_initialize():void {
            /* Dynamically load image at runtime. */
            vBox.setStyle("backgroundImage", "Fx.png");
            vBox.setStyle("backgroundAttachment", "fixed");
        }
    ]]&gt;
&lt;/mx:Script&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Changing a VBox container\&#039;s background image attachment in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/05/changing-a-vbox-containers-background-image-attachment-in-flex/',contentID: 'post-417',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'backgroundAttachment,backgroundImage',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/01/05/changing-a-vbox-containers-background-image-attachment-in-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting the vertical gap between items in a Flex VBox container</title>
		<link>http://blog.flexexamples.com/2008/01/03/setting-the-vertical-gap-between-items-in-a-flex-vbox-container/</link>
		<comments>http://blog.flexexamples.com/2008/01/03/setting-the-vertical-gap-between-items-in-a-flex-vbox-container/#comments</comments>
		<pubDate>Fri, 04 Jan 2008 07:26:02 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[VBox]]></category>
		<category><![CDATA[verticalGap]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/03/setting-the-vertical-gap-between-items-in-a-flex-vbox-container/</guid>
		<description><![CDATA[<p>The following example shows how you can control the amount of vertical spacing between items in a VBox container by setting the verticalGap style.</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/2008/01/03/setting-the-vertical-gap-between-items-in-a-flex-vbox-container/ --&#62; &#60;mx:Application xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#160; &#60;mx:Style&#62; HSlider { dataTipPlacement: bottom; dataTipPrecision: 0; } &#60;/mx:Style&#62; &#160; &#60;mx:Script&#62; &#60;![CDATA[ import [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can control the amount of vertical spacing between items in a VBox container by setting the <code>verticalGap</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-411"></span></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/2008/01/03/setting-the-vertical-gap-between-items-in-a-flex-vbox-container/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        HSlider {
            dataTipPlacement: bottom;
            dataTipPrecision: 0;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.events.FlexEvent;</span>
<span style="color: #339933;">            import mx.events.SliderEvent;</span>
&nbsp;
<span style="color: #339933;">            private function slider_change(evt:SliderEvent):void {</span>
<span style="color: #339933;">                vBox.setStyle(&quot;verticalGap&quot;, evt.value);</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function vBox_creationComplete(evt:FlexEvent):void {</span>
<span style="color: #339933;">                slider.value = vBox.getStyle(&quot;verticalGap&quot;);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ApplicationControlBar</span> dock=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Form</span> styleName=<span style="color: #ff0000;">&quot;plain&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;verticalGap:&quot;</span></span>
<span style="color: #000000;">                    direction=<span style="color: #ff0000;">&quot;horizontal&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:HSlider</span> id=<span style="color: #ff0000;">&quot;slider&quot;</span></span>
<span style="color: #000000;">                        minimum=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #000000;">                        maximum=<span style="color: #ff0000;">&quot;20&quot;</span></span>
<span style="color: #000000;">                        liveDragging=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        snapInterval=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #000000;">                        tickInterval=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;slider_change(event);&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> text=<span style="color: #ff0000;">&quot;{slider.value}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ApplicationControlBar</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VBox</span> id=<span style="color: #ff0000;">&quot;vBox&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;100%&quot;</span></span>
<span style="color: #000000;">            creationComplete=<span style="color: #ff0000;">&quot;vBox_creationComplete(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Box</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;50&quot;</span> backgroundColor=<span style="color: #ff0000;">&quot;red&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Box</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;50&quot;</span> backgroundColor=<span style="color: #ff0000;">&quot;haloOrange&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Box</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;50&quot;</span> backgroundColor=<span style="color: #ff0000;">&quot;yellow&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Box</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;50&quot;</span> backgroundColor=<span style="color: #ff0000;">&quot;haloGreen&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Box</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;50&quot;</span> backgroundColor=<span style="color: #ff0000;">&quot;haloBlue&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_verticalGap_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_verticalGap_test/bin/main.html" width="100%" height="450"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the vertical gap between items in a Flex VBox container on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/03/setting-the-vertical-gap-between-items-in-a-flex-vbox-container/',contentID: 'post-411',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'verticalGap',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/01/03/setting-the-vertical-gap-between-items-in-a-flex-vbox-container/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Setting a Flex container&#8217;s vertical scroll policy</title>
		<link>http://blog.flexexamples.com/2007/11/09/setting-a-flex-containers-vertical-scroll-policy/</link>
		<comments>http://blog.flexexamples.com/2007/11/09/setting-a-flex-containers-vertical-scroll-policy/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 06:51:19 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[VBox]]></category>
		<category><![CDATA[maxVerticalScrollPosition]]></category>
		<category><![CDATA[verticalScrollPolicy]]></category>
		<category><![CDATA[verticalScrollPosition]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/09/setting-a-flex-containers-vertical-scroll-policy/</guid>
		<description><![CDATA[<p>The following example shows how you can use the verticalScrollPolicy property on a Flex VBox container to control the appearance of the vertical scroll bar when the container&#8217;s contents exceed the dimensions of the container.</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/2007/11/09/setting-a-flex-containers-vertical-scroll-policy/ --&#62; &#60;mx:Application xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#160; &#60;mx:Script&#62; &#60;![CDATA[ [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can use the <code>verticalScrollPolicy</code> property on a Flex VBox container to control the appearance of the vertical scroll bar when the container&#8217;s contents exceed the dimensions of the container.</p>
<p>Full code after the jump.</p>
<p><span id="more-267"></span></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/2007/11/09/setting-a-flex-containers-vertical-scroll-policy/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            private function updateScrollPosition():void {</span>
<span style="color: #339933;">                vSP.text = vBox.verticalScrollPosition.toString();</span>
<span style="color: #339933;">                mVSP.text = vBox.maxVerticalScrollPosition.toString();</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
        VBox {
            paddingLeft: 10;
            paddingRight: 10;
            paddingTop: 10;
            paddingBottom: 10;
        }
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Style</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ApplicationControlBar</span> dock=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;verticalScrollPolicy:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ComboBox</span> id=<span style="color: #ff0000;">&quot;comboBox&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Array</span><span style="color: #7400FF;">&gt;</span></span>
                            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;auto&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;on&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> label=<span style="color: #ff0000;">&quot;off&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Array</span><span style="color: #7400FF;">&gt;</span></span>
                    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ComboBox</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;height:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:HSlider</span> id=<span style="color: #ff0000;">&quot;slider&quot;</span></span>
<span style="color: #000000;">                        minimum=<span style="color: #ff0000;">&quot;50&quot;</span></span>
<span style="color: #000000;">                        maximum=<span style="color: #ff0000;">&quot;300&quot;</span></span>
<span style="color: #000000;">                        value=<span style="color: #ff0000;">&quot;50&quot;</span></span>
<span style="color: #000000;">                        liveDragging=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                        snapInterval=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #000000;">                        tickInterval=<span style="color: #ff0000;">&quot;50&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;verticalScrollPosition:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;vSP&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;maxVerticalScrollPosition:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> id=<span style="color: #ff0000;">&quot;mVSP&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ApplicationControlBar</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VBox</span> id=<span style="color: #ff0000;">&quot;vBox&quot;</span></span>
<span style="color: #000000;">            verticalScrollPolicy=<span style="color: #ff0000;">&quot;{comboBox.selectedItem.label}&quot;</span></span>
<span style="color: #000000;">            backgroundColor=<span style="color: #ff0000;">&quot;haloSilver&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;200&quot;</span></span>
<span style="color: #000000;">            height=<span style="color: #ff0000;">&quot;200&quot;</span></span>
<span style="color: #000000;">            updateComplete=<span style="color: #ff0000;">&quot;updateScrollPosition();&quot;</span></span>
<span style="color: #000000;">            creationComplete=<span style="color: #ff0000;">&quot;updateScrollPosition();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Box</span> id=<span style="color: #ff0000;">&quot;box&quot;</span></span>
<span style="color: #000000;">                backgroundColor=<span style="color: #ff0000;">&quot;haloBlue&quot;</span></span>
<span style="color: #000000;">                width=<span style="color: #ff0000;">&quot;100%&quot;</span></span>
<span style="color: #000000;">                height=<span style="color: #ff0000;">&quot;{slider.value}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_verticalScrollPolicy_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_verticalScrollPolicy_test/bin/main.html" width="100%" height="450"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting a Flex container\&#039;s vertical scroll policy on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/09/setting-a-flex-containers-vertical-scroll-policy/',contentID: 'post-267',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'maxVerticalScrollPosition,verticalScrollPolicy,verticalScrollPosition',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/11/09/setting-a-flex-containers-vertical-scroll-policy/feed/</wfw:commentRss>
		<slash:comments>1</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>
		<item>
		<title>Toggling a Flex container&#8217;s visibility</title>
		<link>http://blog.flexexamples.com/2007/08/23/toggling-a-flex-containers-visibility/</link>
		<comments>http://blog.flexexamples.com/2007/08/23/toggling-a-flex-containers-visibility/#comments</comments>
		<pubDate>Fri, 24 Aug 2007 06:07:45 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[VBox]]></category>
		<category><![CDATA[includeInLayout]]></category>
		<category><![CDATA[visible]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/23/toggling-a-flex-containers-visibility/</guid>
		<description><![CDATA[<p>The following example shows a pretty crude method for toggling a container&#8217;s visibility and removing it from the Flex application layout. Mind you, this probably isn&#8217;t the preferred/recommended method of doing this (I imagine using states would be a lot nicer/cleaner) but hey, I&#8217;ll have to save that method up for another entry.</p> <p>Full code [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows a pretty crude method for toggling a container&#8217;s visibility and removing it from the Flex application layout. Mind you, this probably isn&#8217;t the preferred/recommended method of doing this (I imagine using states would be a lot nicer/cleaner) but hey, I&#8217;ll have to save that method up for another entry.</p>
<p>Full code after the jump.</p>
<p><span id="more-115"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/VBox_includeInLayout_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/23/toggling-a-flex-containers-visibility/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

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

    &lt;mx:Script&gt;
        &lt;![CDATA[
            [Bindable]
            [Embed(source="assets/help.png")]
            private var helpIcon:Class;
        ]]&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="vbox2.visible = !vbox2.visible" /&gt;
        &lt;/mx:VBox&gt;

        &lt;mx:VBox id="vbox2"
                width="120"
                height="100%"
                backgroundColor="haloGreen"
                creationComplete="vbox2.visible = false"
                includeInLayout="{vbox2.visible}"&gt;
            &lt;mx:Label text="VBox 2" /&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_includeInLayout_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_includeInLayout_test/bin/main.html" width="100%" height="250"></iframe></p>
<p class="new">For an example of using states to toggle containers, see <a href="http://blog.flexexamples.com/2007/08/24/toggling-a-flex-containers-visibility-using-states/">&#8220;Toggling a Flex container&#8217;s visibility using states&#8221;</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Toggling a Flex container\&#039;s visibility on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/23/toggling-a-flex-containers-visibility/',contentID: 'post-115',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'includeInLayout,visible',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/23/toggling-a-flex-containers-visibility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

