<?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; moveDivider()</title>
	<atom:link href="http://blog.flexexamples.com/tag/movedivider/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>Programmatically resizing a Flex HDividedBox container</title>
		<link>http://blog.flexexamples.com/2007/10/09/programmatically-resizing-a-flex-hdividedbox-container/</link>
		<comments>http://blog.flexexamples.com/2007/10/09/programmatically-resizing-a-flex-hdividedbox-container/#comments</comments>
		<pubDate>Wed, 10 Oct 2007 04:15:30 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[HDividedBox]]></category>
		<category><![CDATA[VDividedBox]]></category>
		<category><![CDATA[getDividerAt()]]></category>
		<category><![CDATA[moveDivider()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/10/09/programmatically-resizing-a-flex-hdividedbox-container/</guid>
		<description><![CDATA[<p>The following example shows how you can programmatically resize an HDividedBox container in Flex using the moveDivider() and getDividerAt() methods.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/HDividedBox_moveDivider_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/10/09/programmatically-resizing-a-flex-hdividedbox-container/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:ApplicationControlBar dock="true"&#62; &#60;!-- Move the divider 20 pixels to the left for as long [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can programmatically resize an HDividedBox container in Flex using the <code>moveDivider()</code> and <code>getDividerAt()</code> methods.</p>
<p>Full code after the jump.</p>
<p><span id="more-226"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/HDividedBox_moveDivider_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/10/09/programmatically-resizing-a-flex-hdividedbox-container/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;!-- Move the divider 20 pixels to the left for as long as the
             Button control is pressed (autoRepeat=true). --&gt;
        &lt;mx:Button label="x-=20"
                autoRepeat="true"
                buttonDown="hdivbox.moveDivider(0, -20);" /&gt;
        &lt;!-- Move the divider 20 pixels to the right for as long as the
             Button control is pressed (autoRepeat=true). --&gt;
        &lt;mx:Button label="x+=20"
                autoRepeat="true"
                buttonDown="hdivbox.moveDivider(0, 20);" /&gt;

        &lt;mx:Spacer width="50" /&gt;

        &lt;!-- Move the divider to 100 pixels from the left. --&gt;
        &lt;mx:Button label="x=100"
                click="hdivbox.getDividerAt(0).x = 100;" /&gt;
        &lt;!-- Move the divider to 420 pixels from the left. --&gt;
        &lt;mx:Button label="x=420"
                click="hdivbox.getDividerAt(0).x = 420;" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:HDividedBox id="hdivbox" width="100%" height="100%"&gt;
        &lt;mx:VBox backgroundColor="haloGreen" width="100%" height="100%"&gt;
            &lt;!-- children --&gt;
        &lt;/mx:VBox&gt;
        &lt;mx:VBox backgroundColor="haloBlue" width="100%" height="100%"&gt;
            &lt;!-- children --&gt;
        &lt;/mx:VBox&gt;
    &lt;/mx:HDividedBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/HDividedBox_moveDivider_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/HDividedBox_moveDivider_test/bin/main.html" width="100%" height="350"></iframe></p>
<p>In the previous example, the <code>moveDivider()</code> method is used to move the divider relative to its current position. So, calling <code>moveDivider(0, 20)</code> moves the first (and only) divider 20 pixels to the right. To move the divider 20 pixels to the right, you&#8217;d pass a negative value for the second parameter, like so:</p>
<pre class="code">moveDivider(0, -20)</pre>
<p>To set the divider to a specific point, you can use the <code>getDividerAt()</code> method and set the divider&#8217;s <code>x</code> property (for a horizontal divided box, if you were using a vertical divided box you would set the <code>y</code> property instead). So again in the previous example, you would use the following code to set the first divider to 100 pixels from the left edge:</p>
<pre class="code">hdivbox.getDividerAt(0).x = 100;</pre>
<p>If you wanted to force the nested VBox containers to have a minimum or maximum width, simply set the <code>minWidth</code> and/or <code>maxWidth</code> properties, as seen in the following snippet:</p>
<pre class="code">
&lt;mx:VBox backgroundColor=&quot;haloGreen&quot;
        width=&quot;100%&quot;
        height=&quot;100%&quot;
        <span style="color:red;">minWidth=&quot;50&quot;
        maxWidth=&quot;250&quot;</span>&gt;
    &lt;!-- children --&gt;
&lt;/mx:VBox&gt;
</pre>
<p>Now when you resize the HDividedBox container&#8217;s divider, the green VBox container will be at least 50 pixels wide and at most 250 pixels wide.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Programmatically resizing a Flex HDividedBox container on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/10/09/programmatically-resizing-a-flex-hdividedbox-container/',contentID: 'post-226',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'getDividerAt(),moveDivider()',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/10/09/programmatically-resizing-a-flex-hdividedbox-container/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>

