<?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>Russischer Bär</title>
	<atom:link href="http://sibirjak.com/osflash/feed/" rel="self" type="application/rss+xml" />
	<link>http://sibirjak.com/osflash</link>
	<description>Open Source Flash</description>
	<lastBuildDate>Wed, 21 Dec 2011 22:25:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PopUpManager, ToolTipManager</title>
		<link>http://sibirjak.com/osflash/blog/popupmanager-tooltipmanager/</link>
		<comments>http://sibirjak.com/osflash/blog/popupmanager-tooltipmanager/#comments</comments>
		<pubDate>Fri, 10 Jun 2011 14:44:52 +0000</pubDate>
		<dc:creator>Jens Struwe</dc:creator>
				<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://sibirjak.com/osflash/?p=2263</guid>
		<description><![CDATA[Version 0.3 of AS3Commons UI comes with the new layers package including managers dealing with main application overlays such as popups and tooltips. PopUpManager Manager class to create, place or remove popups throughout an application. [SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/popup/alerttutorial/AlertTutorial.swf" width="500" height="300" /] Add or remove some popups. See the with in-depth explanation and example code. See the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Version 0.3 of AS3Commons UI</strong> comes with the new layers package including managers dealing with main application overlays such as popups and tooltips.</p>
<h1>PopUpManager</h1>
<p>Manager class to create, place or remove popups throughout an application.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/popup/alerttutorial/AlertTutorial.swf" width="500" height="300" /]</p>
<p class="caption">Add or remove some popups.</p>
<p>See the <a href="http://sibirjak.com/osflash/blog/tutorial-creating-an-alert-box-with-the-as3commons-popupmanager/"><code>PopUpManager</code> tutorial</a> with in-depth explanation and example code.<br />
See the various <a href="http://sibirjak.com/osflash/projects/as3commons-ui/layers/examples/category/popup/"><code>PopUpManager</code> examples</a>.</p>
<h1>ToolTipManager</h1>
<p>Manager class to create, place or remove tooltips throughout an application.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/tooltip/tooltiptutorial/ToolTipTutorial.swf" width="460" height="360" /]</p>
<p class="caption">Hover the colored boxes to see the tooltips. Box #2 shows a larger tooltip. Move the boxes (and tooltips) towards the grey border to see the tooltips auto corrected and auto swapped.</p>
<p>See the <a href="http://sibirjak.com/osflash/blog/tutorial-creating-tooltips-with-the-as3commons-tooltipmanager/"><code>ToolTipManager</code> tutorial</a> with in-depth explanation and example code.<br />
See the various <a href="http://sibirjak.com/osflash/projects/as3commons-ui/layers/examples/category/tooltip/"><code>ToolTipManager</code> examples</a>.</p>
<h1>Placement</h1>
<p>Util class to relate the position of two display objects living in different branches (or the same branch) of the display list.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/placement/PlacementDemo.swf" width="530" height="360" /]</p>
<p class="caption">Change source and layer anchor in the right control panel. Move the source object towards the border to see the placement being auto corrected and anchors being swapped.</p>
<p>See the various <a href="http://sibirjak.com/osflash/projects/as3commons-ui/layers/examples/category/placement/"><code>Placement</code> examples</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sibirjak.com/osflash/blog/popupmanager-tooltipmanager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial: Creating tooltips with the AS3Commons ToolTipManager</title>
		<link>http://sibirjak.com/osflash/blog/tutorial-creating-tooltips-with-the-as3commons-tooltipmanager/</link>
		<comments>http://sibirjak.com/osflash/blog/tutorial-creating-tooltips-with-the-as3commons-tooltipmanager/#comments</comments>
		<pubDate>Fri, 10 Jun 2011 02:31:54 +0000</pubDate>
		<dc:creator>Jens Struwe</dc:creator>
				<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://sibirjak.com/osflash/?p=2213</guid>
		<description><![CDATA[About the ToolTipManager class The ToolTipManager is included in the of the . The class lets you create custom tooltips and register them to be shown for different display objects throughout the application. It is meant to be a pure ActionScript alternative to the well-known tooltip managers incorporated by Flex or the Flash component package. [...]]]></description>
			<content:encoded><![CDATA[<h1>About the ToolTipManager class</h1>
<p>The <code>ToolTipManager</code> is included in the <a href="http://sibirjak.com/osflash/projects/as3commons-ui/layers/">layers package</a> of the <a href="http://sibirjak.com/osflash/projects/as3commons-ui/">AS3Commons UI project</a>. The class lets you create custom tooltips and register them to be shown for different display objects throughout the application. It is meant to be a pure ActionScript alternative to the well-known tooltip managers incorporated by Flex or the Flash component package.</p>
<h1>About this tutorial</h1>
<p>In this tutorial we are going to create a small application containing a couple of boxes where each box will show a tooltip on mouse over. The tooltips should in no case exceed the stage&#8217;s boundaries.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/tooltip/tooltiptutorial/ToolTipTutorial.swf" width="460" height="360" /]</p>
<p>If you want to <a href="#a19-the-final-code-and-the-compiled-swf">see the final code first</a>, jump to the last section of this tutorial.</p>
<p><strong>The tutorial explains:</strong></p>
<ol>
<li>Creating and managing an instance of <code>ToolTipManager</code></li>
<li>Creating a tooltip component</li>
<li>Creating a tooltip adapter</li>
<li>Assigning tooltips to components</li>
<li>Animating the tooltip&#8217;s show and hide events</li>
</ol>
<h1>Requirements</h1>
<h2>Owner and tooltip size</h2>
<p>The <code>ToolTipManager</code> relies on the <code>width</code> and <code>height</code> properties of both the owner and the tooltip object. You need to make sure that these properties are set and return the actual size of the component at the time the <code>ToolTipManager.show()</code> method is invoked. Otherwise the <code>ToolTipManager</code> cannot set a valid position of the tooltip.</p>
<h2>External libraries</h2>
<p>To run the code shown in this tutorial you need to install the following libraries.</p>
<ul>
<li>AS3Commons UI 0.3 &#8211; Contains the PopUpManager and several layout algorithms</li>
<li>AS3Commons Collections 1.3.0 &#8211; Data structures required by AS3Commons UI</li>
<li>GTween 2.01 &#8211; Tweening library of choice</li>
</ul>
<p>All libraries are included in the ZIP download of the AS3Commons UI project.</p>
<h1>Creating a simple moveable box and a basic tooltip</h1>
<p>To be able to test the behaviour of our later tooltip we need a source or owner object that can be freely moved aournd the stage. Such an object is not very special and easliy created. We will call it box. Moving the mouse over the box will bring the box to front before all other boxes. Moving the box is restricted to the specified boundaries. We store these boundaries in a global variable since we will later use them on different places.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/tooltip/tooltiptutorial/ToolTipTutorialStep1.swf" width="460" height="360" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/step1/Box.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/step1/Globals.as" /]</p>
<p>A basic tooltip is roughly a text field with background and border. Since a tooltip can be shared between different components, it should be possible to assign text at runtime.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/step1/BoxToolTip.as" /]</p>
<h1>Setup of <code>ToolTipManager</code></h1>
<p>The <code>ToolTipManager</code> expects a tooltip container display object within its constructor. We we will create the container at the very top of our application. There should be only one instance of <code>ToolTipManager</code> for a single application. We hence store the <code>ToolTipManager</code> instance in our global class <code>Globals</code> created in step 1.</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">...</span><br />
Globals<span style="color: #000066; font-weight: bold;">.</span>bounds = bounds<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// init tooltips</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> container <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Sprite</span> = <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">Sprite</span><span style="color: #000066; font-weight: bold;">;</span><br />
Globals<span style="color: #000066; font-weight: bold;">.</span>toolTipManager = <span style="color: #0033ff; font-weight: bold;">new</span> ToolTipManager<span style="color: #000000;">&#40;</span>container<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// add content</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> items <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Sprite</span> = <span style="color: #004993;">addChildAt</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">Sprite</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000066; font-weight: bold;">...</span></div></div></div>

<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/final/Globals.as" /]</p>
<h2>Triggering the tooltip from the box</h2>
<p>The box should show a tooltip when the move enters the box and hide when the mouse leaves. Once we have the single <code>ToolTipManager</code> accessible by the box we can put the appropriate code.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/final/Box.as" /]</p>
<h2>Register the tooltip</h2>
<p>A tooltip can be shown by invoking the <code>ToolTipManager.show(owner, content)</code> method. Internally the <code>ToolTipManager</code> decides what actual tooltip class is to use for the particular owner component. To connect our simple tooltip with the box object we need to register it.</p>
<p>The <code>ToolTipManager</code> is designed to support arbitrary display objects as both owner and tooltip. To anyhow let the <code>ToolTipManager</code> communicate with our tooltip we need to create an adapter that will serve as an mediator between both. A tooltip adapter must subclass the base <code>ToolTipAdapter</code> class and here override certain adapter hooks.</p>
<h3>The <code>ToolTipAdapter</code> hooks</h3>
<h4>onToolTip()</h4>
<p><strong>When it is invoked</strong></p>
<ul>
<li>Once for a tooltip</li>
<li>Right after the tooltip has been registered</li>
</ul>
<p><strong>Purpose</strong></p>
<p>Set up initial adapter properties such as offsets or enable anchor swaps.</p>
<h4>onContent()</h4>
<p><strong>When it is invoked</strong></p>
<p>Called whenever the source object and content have been changed.</p>
<p><strong>Purpose</strong></p>
<p>The content usually will be someting literally. This hook should forward the content specified by the owner object to the tooltip. The tooltip is supposed store this content and to calculate here it&#8217;s final dimensions. The tooltip does not necessary need to draw its final appearance here. The tooltip adapter will query the tooltip&#8217;s dimensions right after this hook has been invoked and calculate the tooltip&#8217;s position.</p>
<h4>onDraw()</h4>
<p><strong>When it is invoked</strong></p>
<p>Called whenever a hidden tooltip should be shown.</p>
<p><strong>Purpose</strong></p>
<p>The tooltip is supposed to set the tooltip&#8217;s position and create its final appearance.</p>
<h4>onRemove()</h4>
<p><strong>When it is invoked</strong></p>
<p>Called whenever a tooltip should be hidden.</p>
<p><strong>Purpose</strong></p>
<p>To finalize the removal, the adapter needs to commit the removal by invocation of <code>commitRemove()</code> within this hook. The adapter may call <code>commitRemove()</code> synchronously or asynchronously. The latter case is appropriate if some transitions should be performed before the tooltip leaves.</p>
<h3>Simple tooltip adapter</h3>
<p>The most simple adapter only overrides the <code>onContent()</code> hook and forward the given content to the tooltip.</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MyToolTipAdapter <span style="color: #0033ff; font-weight: bold;">extends</span> ToolTipAdapter <span style="color: #000000;">&#123;</span><br />
&nbsp; override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> onContent<span style="color: #000000;">&#40;</span>toolTip <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">DisplayObject</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">content</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; MyToolTip<span style="color: #000000;">&#40;</span>toolTip<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #004993;">content</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div></div>

<h3>The tooltip selector</h3>
<p>The tooltip registration additionally requires the declaration of a tooltip selector together with the adapter and the tooltip itself. The selector accepts an arbitrary display object and decides if this object should use the mapped tooltip adapter or not. The selector is a perfect pattern to assign a certain tooltip right to a class of components while enabling different tootlips for different components.</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MyTipSelector implements IToolTipSelector <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> approve<span style="color: #000000;">&#40;</span>displayObject <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">DisplayObject</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> displayObject <span style="color: #0033ff; font-weight: bold;">is</span> MyComponent<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div></div>

<h3>The registration</h3>
<p>Having tooltip, adapter and selector, the registration is a single line of code:</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;">_toolTipManager<span style="color: #000066; font-weight: bold;">.</span>registerToolTip<span style="color: #000000;">&#40;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> MyToolTipSelector<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> MyToolTipAdapter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> MyToolTip<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div></div>

<p>Here is our step 2 code with tooltip adapter, selector and registration. The tooltip did not change from step1.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/tooltip/tooltiptutorial/ToolTipTutorialStep2.swf" width="460" height="360" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/step2/ToolTipTutorialStep2.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/step2/BoxToolTipAdapter.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/final/BoxToolTipSelector.as" /]</p>
<p>The tooltips are now already working but could be improved a bit to not exceed the boundaries and to slightly extend into (overlap) the owner object.</p>
<h1>Customizing the tooltip placement</h1>
<p>There are different tooltip placement rules we may set up in our tooltip adapter. The appropriate adapter hook is <code>onToolTip()</code>.</p>
<h2>Anchors</h2>
<p>Aligns owner and tooltip object. By default the owner anchor is <code>PlacementAnchor.TOP_RIGHT</code> and the tooltip anchor is <code>PlacementAnchor.BOTTOM_LEFT</code>. To modify the default anchors to show the tooltips centered below their owner we modify our tooltip adapter like this:</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/step3/TestBoxToolTipAdapter.as" /]</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/tooltip/tooltiptutorial/ToolTipTutorialStep3.swf" width="460" height="360" /]</p>
<h2>Offset</h2>
<p>Shifts the tooltip from the default placement by the value specified by the offset point object.</p>
<h2>Bounds</h2>
<p>If specified, all tooltip positions will be auto corrected to keep the tooltip within the boundary rect.</p>
<h2>Auto swap anchors</h2>
<p>If bounds are given, the tooltip will be locked at the bounds in the case the tooltip would exceed the bounds. The tooltip adapter enables you to let the placement anchors swap automatically. A tooltip that would jut out the right side is then swapped to the left side of the owner object.</p>
<h2>Auto swap anchors tolerance</h2>
<p>This is a combination of auto swap and simple auto correction. A tolerance value starting from that the swap will be performed. If set to 10, the tooltip will be swapped not until it would exceed the bounds by the amount of 10 pixel.</p>
<p>We configure our tooltip adapter for the following placement rules:</p>
<ul>
<li>Offet of (-10, 5)</li>
<li>Stop on bounds</li>
<li>Swap anchors horizontally with a tolerance of 25 pixel</li>
<li>Swap anchors vertically with a tolerance of 10 pixel</li>
</ul>
<p>Additionally we set the <code>autoHideAfter</code> property to 2 seconds. After two seconds the tooltip will disappear automatically.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/step3/BoxToolTipAdapter.as" /]</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/tooltip/tooltiptutorial/ToolTipTutorialStep3b.swf" width="460" height="360" /]</p>
<p>Our tooltip is already quite comfortable. The next improvement is to animate the tooltip&#8217;s show and hide events.</p>
<h1>Animating tooltip show and hide events</h1>
<p>Animation is not actually subject of this tutorial. However, some notes here:</p>
<p>When you override the <code>onShow()</code> adapter hook you are in charge to set the tooltip position and invoke the <code>startAutoHide()</code> command on your own.</p>
<p>When you override the <code>onRemove()</code> adapter hook you are in charge to invoke the <code>commitRemove()</code> command on your own.</p>
<p>Reason for this reversion of control is that only you as the adapter developer know the point of time the commands for auto hide or remove are safe to execute.</p>
<h2>Setting the tooltips position</h2>
<p>By default, <code>onShow()</code> sets the correct tooltip position. You might add certain asynchronous transitions and set the position at a later time.</p>
<h2><code>startAutoHide()</code></h2>
<p>Starts the auto hide delay if the <code>autoHideAfter</code> property is set. This command is invoked by the base implementation of <code>onShow()</code>. You might add certain asynchronous transitions and start the auto hide delay after the tooltip is entirely shown.</p>
<h2><code>commitRemove()</code></h2>
<p>Removes the tooltip eventually. This command is invoked by the base implementation of <code>onRemove()</code>. You might add certain asynchronous transitions and remove the tooltip after the transitions have been finished.</p>
<p>The following adapter animates the tooltip&#8217;s show and hide events.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/step4/BoxToolTipAdapter.as" /]</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/tooltip/tooltiptutorial/ToolTipTutorialStep4.swf" width="460" height="360" /]</p>
<h1>Adavanced Tooltip</h1>
<p>The last step of the tutorial is to update the tooltip to show a nose. The orientation and position of the nose depends on the used placement properties. By default the tooltip is shown top right of its owner. The nose here is bottom left. If the tooltip is swapped horizontally, the nose will be bottom right. Vertically: top-right or top-left. Another requirement is to respect a possible auto correct shift. If the tooltip is auto corrected at the right border and shifted by a value of 20px, the tooltip nose should also move by 20px to the right ;D</p>
<p>See the final code for such an advanced tooltip. It differs to our step 4 version only in the implementation of the drawing of the tooltip and the passing of used placement values to the tooltip.</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;">override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> onDraw<span style="color: #000000;">&#40;</span>toolTip <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">DisplayObject</span><span style="color: #000066; font-weight: bold;">,</span> ownerAnchor <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span><span style="color: #000066; font-weight: bold;">,</span> toolTipAnchor <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span><span style="color: #000066; font-weight: bold;">,</span> hShift <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">int</span><span style="color: #000066; font-weight: bold;">,</span> vShift <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; BoxToolTip<span style="color: #000000;">&#40;</span>toolTip<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>setPlacementProperties<span style="color: #000000;">&#40;</span>ownerAnchor<span style="color: #000066; font-weight: bold;">,</span> toolTipAnchor<span style="color: #000066; font-weight: bold;">,</span> hShift<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; BoxToolTip<span style="color: #000000;">&#40;</span>toolTip<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div></div>

<h1>The final code and the compiled swf</h1>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/tooltip/tooltiptutorial/ToolTipTutorial.swf" width="460" height="360" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/final/ToolTipTutorial.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/final/BoxToolTip.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/final/BoxToolTipAdapter.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/final/BoxToolTipSelector.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/final/Box.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/tooltip/tooltiptutorial/final/Globals.as" /]</p>
]]></content:encoded>
			<wfw:commentRss>http://sibirjak.com/osflash/blog/tutorial-creating-tooltips-with-the-as3commons-tooltipmanager/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Tutorial: Creating an alert box with the AS3Commons PopUpManager</title>
		<link>http://sibirjak.com/osflash/blog/tutorial-creating-an-alert-box-with-the-as3commons-popupmanager/</link>
		<comments>http://sibirjak.com/osflash/blog/tutorial-creating-an-alert-box-with-the-as3commons-popupmanager/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 15:27:05 +0000</pubDate>
		<dc:creator>Jens Struwe</dc:creator>
				<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://sibirjak.com/osflash/?p=2165</guid>
		<description><![CDATA[About the PopUpManager class The PopUpManager is included in the of the . The class lets you create, place or remove popups throughout an application. It is meant to be a pure ActionScript alternative to the well-known popup managers incorporated by Flex or the Flash component package. About this tutorial In this tutorial we are [...]]]></description>
			<content:encoded><![CDATA[<h1>About the PopUpManager class</h1>
<p>The <code>PopUpManager</code> is included in the <a href="http://sibirjak.com/osflash/projects/as3commons-ui/layers/">layers package</a> of the <a href="http://sibirjak.com/osflash/projects/as3commons-ui/">AS3Commons UI project</a>. The class lets you create, place or remove popups throughout an application. It is meant to be a pure ActionScript alternative to the well-known popup managers incorporated by Flex or the Flash component package.</p>
<h1>About this tutorial</h1>
<p>In this tutorial we are going to create a small application containing two buttons where each button triggers an alert box showing some text. The first button starts a simple message box that will vanish by a subsequent click anywhere into the application. The second button starts a modal dialog that must be confirmed.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/popup/alerttutorial/AlertTutorial.swf" width="500" height="300" /]</p>
<p>If you want to <a href="#a9-the-final-code-and-the-compiled-swf">see the final code first</a>, jump to the last section of this tutorial.</p>
<p><strong>The tutorial explains:</strong></p>
<ol>
<li>Creating and managing an instance of <code>PopUpManager</code></li>
<li>Creating and removing a popup</li>
<li>Placing a popup</li>
<li>Modal and modeless popups</li>
<li>Animating the popup&#8217;s show and hide events</li>
</ol>
<h1>Requirements</h1>
<p>To run the code shown in this tutorial you need to install the following libraries.</p>
<ul>
<li>AS3Commons UI 0.3 &#8211; Contains the PopUpManager and several layout algorithms</li>
<li>AS3Commons Collections 1.3.0 &#8211; Data structures required by AS3Commons UI</li>
<li>GTween 2.01 &#8211; Tweening library of choice</li>
<li>AS DataProvider Controls 0.4.0 &#8211; User interface components</li>
</ul>
<p>All libraries are included in the ZIP download of the AS3Commons UI project.</p>
<h1>Creating a generic alert component</h1>
<p>In the first step of this tutorial we create a simple alert component. The component has a fix size of 300&#215;160 px. It shows a headline and a message. It is possible to configure the alert box to show up to 3 buttons. Each button will dispatch its custom event type. The first button the type <code>AlertBox.ALERT_YES</code>, the second button the type <code>AlertBox.ALERT_NO</code> and the third button the type <code>AlertBox.ALERT_CANCEL</code>. To configure the buttons, the constructor accepts a buttons property (type <code>Array</code>) which contains names for all buttons that should be shown. The event will be forwarded to the callback also specified in a constructor argument. There is actually nothing special with the alert box.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/step1/AlertBox.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/step1/AlertTutorialStep1.as" /]</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/popup/alerttutorial/AlertTutorialStep1.swf" width="330" height="220" /]</p>
<p>Let&#8217;s test another configuration with only one button, the third button that should dispatch the event <code>AlertBox.ALERT_CANCEL</code>. We change the buttons property from <code>["one", "two", "three"]</code> to <code>[null, null, "three"]</code>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>22
23
24
25
26
27
</pre></td><td class="code"><div class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> alert <span style="color: #000066; font-weight: bold;">:</span> AlertBox = <span style="color: #0033ff; font-weight: bold;">new</span> AlertBox<span style="color: #000000;">&#40;</span><br />
&nbsp; <span style="color: #990000;">&quot;Popup&quot;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; <span style="color: #990000;">&quot;This is a simple popup window with only one button. Click it.&quot;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; <span style="color: #000000;">&#91;</span><span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;three&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; <span style="color: #004993;">info</span><br />
<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></table></div>

<p>It works as expected:</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/popup/alerttutorial/AlertTutorialStep1b.swf" width="330" height="220" /]</p>
<p>In step 1 we have added the alert box right below the main application. In the next step we will use the <code>PopUpManager</code> to add the box to the display list.</p>
<h1>Setup of <code>PopUpManager</code></h1>
<p>The <code>PopUpManager</code> expects a popup container display object within its constructor. We we will create the container at the very top of our application. There should be only one instance of <code>PopUpManager</code> for a single application. We hence store the <code>PopUpManager</code> instance in a local variable of the main application. Finally, we call <code>PopUpManager.createPopUp(alert)</code> instead of <code>addChild(alert)</code> to add the alert box to the display list.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/step2/AlertTutorialStep2.as" /]</p>
<p>The resulting SWF is identical to the one of step 1.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/popup/alerttutorial/AlertTutorialStep2.swf" width="330" height="220" /]</p>
<p>We will now implement the code to remove the popup with a click of each of the buttons. To create a new popup, we will add an appropriate button to the main application.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/step2/AlertTutorialStep2b.as" /]</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/popup/alerttutorial/AlertTutorialStep2b.swf" width="330" height="220" /]</p>
<h1>Different alerts</h1>
<p>In step 3 we add a second button to the main application to be able to show either a modeless or a modal popup. The modeless popup only shows a cancel button. The popups are centered automatically.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/step3/AlertTutorialStep3.as" /]</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/popup/alerttutorial/AlertTutorialStep3.swf" width="500" height="300" /]</p>
<p>It is a good idea to not require the user to click the close button of a normal popup. Instead, the popup should also vanish with a click somewhere outside the popup. A clean implementation of such an mouse down outside listener is to let the alert track the mouse down event on demand and notify the main application if it should be closed. In result there will be only one modeless alert at the same time since clicking the add button will automatically remove the present alert box, if any.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/step3/AlertBox.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/step3/AlertTutorialStep3b.as" /]</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/popup/alerttutorial/AlertTutorialStep3b.swf" width="500" height="300" /]</p>
<h1>Adding transitions</h1>
<p>We have almost finished our tutorial. In the step 4 we add some show and hide animation using a tweening library. Additionally, we will show a feedback for the case the yes or no button of the modal popup has been clicked. To do the latter, we simply create a new modeless popup showing the feedback right after the modal window has been closed.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/step4/AlertTutorialStep4.as" /]</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/popup/alerttutorial/AlertTutorialStep4.swf" width="500" height="300" /]</p>
<h1>Optimizations</h1>
<p>We will finalize our tutorial with a few optimizations. The alert handling can be separated from the main class into a static <code>Alert</code> service. This service needs to know the <code>PopUpManager</code> instance which we will store now separately from the main application in a globally accessible variable. At last we add a custom modal overlay showing a grey area instead of the default white one.</p>
<h1>The final code and the compiled swf</h1>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/as3commons_ui/layer/popup/alerttutorial/AlertTutorial.swf" width="500" height="300" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/final/AlertTutorial.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/final/AlertBox.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/final/Alert.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/final/Globals.as" /]</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-ui/examples/layer/popup/alerttutorial/final/ModalOverlay.as" /]</p>
]]></content:encoded>
			<wfw:commentRss>http://sibirjak.com/osflash/blog/tutorial-creating-an-alert-box-with-the-as3commons-popupmanager/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Invalidation &amp; LifeCycle</title>
		<link>http://sibirjak.com/osflash/blog/invalidation-lifecycle/</link>
		<comments>http://sibirjak.com/osflash/blog/invalidation-lifecycle/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 00:24:55 +0000</pubDate>
		<dc:creator>Jens Struwe</dc:creator>
				<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://sibirjak.com/osflash/?p=2006</guid>
		<description><![CDATA[The version 0.2 of AS3Commons UI comes with a new package called Invalidation &#038; LifeCycle. The package provides a clean and simple implementation of a component life cycle. See the for more information on this package.]]></description>
			<content:encoded><![CDATA[<p>The version 0.2 of AS3Commons UI comes with a new package called Invalidation &#038; LifeCycle. The package provides a clean and simple implementation of a component life cycle. See the <a href="http://sibirjak.com/osflash/projects/as3commons-ui/invalidation-lifecycle/">Invalidation &#038; LifeCycle documentation</a> for more information on this package.</p>
]]></content:encoded>
			<wfw:commentRss>http://sibirjak.com/osflash/blog/invalidation-lifecycle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASDPC on GitHub and Version 0.4.0</title>
		<link>http://sibirjak.com/osflash/blog/asdpc-on-github-and-version-0-4-0/</link>
		<comments>http://sibirjak.com/osflash/blog/asdpc-on-github-and-version-0-4-0/#comments</comments>
		<pubDate>Fri, 20 May 2011 14:44:47 +0000</pubDate>
		<dc:creator>Jens Struwe</dc:creator>
				<category><![CDATA[ASDPC]]></category>

		<guid isPermaLink="false">http://sibirjak.com/osflash/?p=1842</guid>
		<description><![CDATA[I&#8217;ve also moved the UI components to GitHub. The relocation comes with a new version. See the list of changes in the changelog provided. GitHub: https://github.com/kakenbok/ActionScript-DataProvider-Controls Changelog: https://github.com/kakenbok/ActionScript-DataProvider-Controls/blob/master/Changelog.txt]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve also moved the UI components to GitHub. The relocation comes with a new version. See the list of changes in the changelog provided.</p>
<p>GitHub: <a href="https://github.com/kakenbok/ActionScript-DataProvider-Controls">https://github.com/kakenbok/ActionScript-DataProvider-Controls</a><br />
Changelog: <a href="https://github.com/kakenbok/ActionScript-DataProvider-Controls/blob/master/Changelog.txt">https://github.com/kakenbok/ActionScript-DataProvider-Controls/blob/master/Changelog.txt</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sibirjak.com/osflash/blog/asdpc-on-github-and-version-0-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#8217;s new in A3Commons Collections 1.3.0</title>
		<link>http://sibirjak.com/osflash/blog/whats-new-in-a3commons-collections-1-3-0/</link>
		<comments>http://sibirjak.com/osflash/blog/whats-new-in-a3commons-collections-1-3-0/#comments</comments>
		<pubDate>Sun, 15 May 2011 09:47:20 +0000</pubDate>
		<dc:creator>Jens Struwe</dc:creator>
				<category><![CDATA[Collections]]></category>

		<guid isPermaLink="false">http://sibirjak.com/osflash/?p=1789</guid>
		<description><![CDATA[The release 1.3.0 of the collections framework contains several utilities and convenience methods. There are four new util classes and four new builder classes. Checkout the Git commit log for a detailed list of changes. The APIDoc is updated as well. Get: Follow: Read: Test: New features The main features added are: Copy items from [...]]]></description>
			<content:encoded><![CDATA[<p>The release 1.3.0 of the collections framework contains several utilities and convenience methods. There are four new util classes and four new builder classes. Checkout the Git commit log for a detailed list of changes. The APIDoc is updated as well.</p>
<p>Get: <a href="http://sibirjak.com/osflash/projects/as3commons-collections/">Downloads</a><br />
Follow: <a href="https://github.com/AS3Commons/as3commons-collections">GitHub</a><br />
Read: <a href="http://as3commons.github.com/as3commons-collections/apidoc/">APIDoc</a><br />
Test: <a href="http://sibirjak.com/osflash/projects/as3commons-collections/examples/category/tools/">Examples</a></p>
<h1>New features</h1>
<p>The main features added are:</p>
<ul>
<li>Copy items from one collection to another</li>
<li>Clone collections</li>
<li>Populate a collection from native Flash objects</li>
<li>Fast populate a collection using variable argument lists</li>
</ul>
<h1>Examples</h1>
<h2>Copy items from one collection to another</h2>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-collections/examples/ListsCopyExample.as" /]</p>
<h2>Clone collections</h2>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-collections/examples/MapsCloneExample.as" /]</p>
<h2>Populate a collection from native Flash objects</h2>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-collections/examples/MapsAddFromExample.as" /]</p>
<h2>Fast populate a collection using variable argument lists</h2>
<p>[Example url="/var/www/jes/sibirjak_com_git/as3commons-collections/examples/AddFromArgsExample.as" /]</p>
]]></content:encoded>
			<wfw:commentRss>http://sibirjak.com/osflash/blog/whats-new-in-a3commons-collections-1-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3Commons Collections now on GitHub</title>
		<link>http://sibirjak.com/osflash/blog/as3commons-collections-now-on-github/</link>
		<comments>http://sibirjak.com/osflash/blog/as3commons-collections-now-on-github/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 10:46:24 +0000</pubDate>
		<dc:creator>Jens Struwe</dc:creator>
				<category><![CDATA[Collections]]></category>

		<guid isPermaLink="false">http://sibirjak.com/osflash/?p=1748</guid>
		<description><![CDATA[I just have setup a GitHub repository for the AS3Commons Collections project. As of now you may fork, clone and download the sources there. The former SVN branch is still existant and updated from time to time in order keep the AS3Commons Maven repository up to date. Nevertheless, the most recent version of this project [...]]]></description>
			<content:encoded><![CDATA[<p>I just have setup a GitHub repository for the AS3Commons Collections project. As of now you may fork, clone and download the sources there. The former SVN branch is still existant and updated from time to time in order keep the AS3Commons Maven repository up to date. Nevertheless, the most recent version of this project is always available on GitHub.</p>
<p>GitHub: <a href="https://github.com/AS3Commons/as3commons-collections">https://github.com/AS3Commons/as3commons-collections</a></p>
<p>Contribution is highly welcome!</p>
]]></content:encoded>
			<wfw:commentRss>http://sibirjak.com/osflash/blog/as3commons-collections-now-on-github/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Announcement: Layouts</title>
		<link>http://sibirjak.com/osflash/blog/announcement-layouts/</link>
		<comments>http://sibirjak.com/osflash/blog/announcement-layouts/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 17:12:48 +0000</pubDate>
		<dc:creator>Jens Struwe</dc:creator>
				<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://sibirjak.com/osflash/?p=1531</guid>
		<description><![CDATA[Note: Layouts already has been released. The code examples are not longer entirely valid. The API has been refined and improved. See the for detailed information and more up to date examples. Layouts is a small layout framework containing solely a horizontal and a vertical layout. Nevertheless, both are more than simple to handle and [...]]]></description>
			<content:encoded><![CDATA[<p style="color:#CC3300">Note: Layouts already has been released. The code examples are not longer entirely valid. The API has been refined and improved. See the <a href="http://sibirjak.com/osflash/projects/as3commons-ui/layouts/">Layouts documentation</a> for detailed information and more up to date examples.</p>
<p>Layouts is a small layout framework containing solely a horizontal and a vertical layout. Nevertheless, both are more than simple to handle and have a great number of properties to adjust. Besides the usual layout algorithms Layouts provides a fluent interface to create runtime layouts as easy as it could be. Coming soon. Here a showcase in advance.</p>
<h1>HLayout</h1>
<p>4 different setups for a horizontal layout. The example shows a number of the config properties of the HLayout.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/uitools/examples/layout/HLayoutExample.swf" width="530" height="290" /]</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> layout<span style="color: #000066; font-weight: bold;">.</span>showcase <span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.</span>HLayout<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">shortcut</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Sprite</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Rectangle</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> HLayoutExample <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">Sprite</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> HLayoutExample<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// layout 1</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> layout <span style="color: #000066; font-weight: bold;">:</span> HLayout = hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;x&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;y&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;maxContentWidth&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">230</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; getBoxes<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">16</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>contentArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// layout 2</span><br />
&nbsp; &nbsp; &nbsp; layout = hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;x&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;y&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">150</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;width&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">230</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;minHeight&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">110</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">3</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">3</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;vRowAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;justify&quot;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;justify&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;justify&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; getBoxes<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">20</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>contentArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// layout 3</span><br />
&nbsp; &nbsp; &nbsp; layout = hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;x&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">270</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;y&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;width&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">230</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;minHeight&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">110</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;vRowAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;middle&quot;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;center&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;middle&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; getBoxes<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">12</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>contentArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// layout 4</span><br />
&nbsp; &nbsp; &nbsp; layout = hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;x&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">270</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;y&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">150</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;width&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">230</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;minHeight&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">110</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;maxItemsPerRow&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;vRowAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;bottom&quot;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;right&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;bottom&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; getBoxes<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">12</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>contentArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> getBoxes<span style="color: #000000;">&#40;</span>numBoxes <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">random</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> boxes <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> numBoxes<span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; boxes<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #004993;">random</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> boxes<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Rectangle</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000000;">&#41;</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">inflate</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">with</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">graphics</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x333333<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div></div>

<h1>VLayout</h1>
<p>This is actually the mirrored HLayout example from above.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/uitools/examples/layout/VLayoutExample.swf" width="290" height="530" /]</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> layout<span style="color: #000066; font-weight: bold;">.</span>showcase <span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.</span>VLayout<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">shortcut</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Sprite</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Rectangle</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> VLayoutExample <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">Sprite</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> VLayoutExample<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// layout 1</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> layout <span style="color: #000066; font-weight: bold;">:</span> VLayout = vlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;x&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;y&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;maxContentHeight&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">230</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; getBoxes<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">16</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>contentArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// layout 2</span><br />
&nbsp; &nbsp; &nbsp; layout = vlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;x&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">150</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;y&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;height&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">230</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;minWidth&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">110</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">3</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">3</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hColumnAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;justify&quot;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;justify&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;justify&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; getBoxes<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">20</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>contentArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// layout 3</span><br />
&nbsp; &nbsp; &nbsp; layout = vlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;x&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;y&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">270</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;height&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">230</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;minWidth&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">110</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hColumnAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;center&quot;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;center&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;middle&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; getBoxes<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">12</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>contentArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// layout 4</span><br />
&nbsp; &nbsp; &nbsp; layout = vlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;x&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">150</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;y&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">270</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;height&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">230</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;minWidth&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">110</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;maxItemsPerColumn&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hColumnAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;right&quot;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;right&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;bottom&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; getBoxes<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">12</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>contentArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> getBoxes<span style="color: #000000;">&#40;</span>numBoxes <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">random</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> boxes <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> numBoxes<span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; boxes<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #004993;">random</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> boxes<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Rectangle</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000000;">&#41;</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">inflate</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">with</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">graphics</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x333333<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div></div>

<h1>Nested Layouts</h1>
<p>Creating nested layouts with the fluent interface is fun.</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> layout<span style="color: #000066; font-weight: bold;">.</span>showcase <span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">shortcut</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Sprite</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> NestedLayoutExample <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">Sprite</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> NestedLayoutExample<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; vlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #009900; font-style: italic;">// 1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #009900; font-style: italic;">// 2</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #009900; font-style: italic;">// 3</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #009900; font-style: italic;">// 4</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #009900; font-style: italic;">// 5</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vlayout<span style="color: #000000;">&#40;</span>&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #009900; font-style: italic;">// 6</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #009900; font-style: italic;">// 7</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #009900; font-style: italic;">// 8</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #009900; font-style: italic;">// 9</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #009900; font-style: italic;">// 10</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div></div>

<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/uitools/examples/layout/NestedLayoutExample.swf" width="200" height="110" /]</p>
<p>The same layout using the getter/setter API.</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> layout<span style="color: #000066; font-weight: bold;">.</span>showcase <span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Sprite</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> NestedLayoutOldSchoolExample <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">Sprite</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> NestedLayoutOldSchoolExample<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> h1 <span style="color: #000066; font-weight: bold;">:</span> HLayout = <span style="color: #0033ff; font-weight: bold;">new</span> HLayout<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v1 <span style="color: #000066; font-weight: bold;">:</span> VLayout = <span style="color: #0033ff; font-weight: bold;">new</span> VLayout<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; v1<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #009900; font-style: italic;">// 1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #009900; font-style: italic;">// 2</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> h2 <span style="color: #000066; font-weight: bold;">:</span> HLayout = <span style="color: #0033ff; font-weight: bold;">new</span> HLayout<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; h2<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #009900; font-style: italic;">// 3</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #009900; font-style: italic;">// 4</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; v1<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span>h2<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; h1<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v1<span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #009900; font-style: italic;">// 5</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> h3 <span style="color: #000066; font-weight: bold;">:</span> HLayout = <span style="color: #0033ff; font-weight: bold;">new</span> HLayout<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v2 <span style="color: #000066; font-weight: bold;">:</span> VLayout = <span style="color: #0033ff; font-weight: bold;">new</span> VLayout<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; v2<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #009900; font-style: italic;">// 6</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #009900; font-style: italic;">// 7</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #009900; font-style: italic;">// 8</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; h3<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v2<span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #009900; font-style: italic;">// 9</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; h1<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; h3<span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #009900; font-style: italic;">// 10</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; h1<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div></div>

<h1>Excluding from Layouts</h1>
<p>Items may be excluded from being considered in layout algorithms. They still are member of their layout but do not consume space. The example shows additionally ways to identify and retrieve items from a layout.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/uitools/examples/layout/ExcludeFromLayoutTest.swf" width="310" height="290" /]</p>
<p>Click a box to exclude it from or to include it in the layout.</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> layout<span style="color: #000066; font-weight: bold;">.</span>showcase <span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">shortcut</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Sprite</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Rectangle</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> ExcludeFromLayoutTest <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">Sprite</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _layout <span style="color: #000066; font-weight: bold;">:</span> VLayout<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _top <span style="color: #000066; font-weight: bold;">:</span> VLayout<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _bottom <span style="color: #000066; font-weight: bold;">:</span> HLayout<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> ExcludeFromLayoutTest<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; _layout = vlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;x&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;y&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">30</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; meta<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;top&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; vlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; h1<span style="color: #000066; font-weight: bold;">,</span> h1<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; meta<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;bottom&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;maxItemsPerRow&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">9</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; _top =_layout<span style="color: #000066; font-weight: bold;">.</span>getItemById<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;top&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; _bottom =_layout<span style="color: #000066; font-weight: bold;">.</span>getItemById<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;bottom&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> clickHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> h1<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> HLayout <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;hGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; h2<span style="color: #000066; font-weight: bold;">,</span> h2<span style="color: #000066; font-weight: bold;">,</span> h2<span style="color: #000066; font-weight: bold;">,</span> h2<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> h2<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> HLayout <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;maxItemsPerRow&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> clickHandler<span style="color: #000000;">&#40;</span>event <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> box <span style="color: #000066; font-weight: bold;">:</span> Box = event<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span> <span style="color: #0033ff; font-weight: bold;">as</span> Box<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span> <span style="color: #000066; font-weight: bold;">!</span>= <span style="color: #990000;">&quot;removed&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _top<span style="color: #000066; font-weight: bold;">.</span>excludeFromLayout<span style="color: #000000;">&#40;</span>box<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _bottom<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span>box<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span> = <span style="color: #990000;">&quot;removed&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _bottom<span style="color: #000066; font-weight: bold;">.</span>remove<span style="color: #000000;">&#40;</span>box<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _top<span style="color: #000066; font-weight: bold;">.</span>includeInLayout<span style="color: #000000;">&#40;</span>box<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; box<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> layout<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; _layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>_top<span style="color: #000066; font-weight: bold;">.</span>visibleArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>_bottom<span style="color: #000066; font-weight: bold;">.</span>visibleArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Rectangle</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000000;">&#41;</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">inflate</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">with</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">graphics</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x333333<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div></div>

<h1>Retrieving Layout Information</h1>
<p>After being layouted, a layout provides three versions of size information. They might be used to do some drawing depending on the final display object positions. The layout area (grey) starts from the top left point of the layouted display container and includes all space of the layout or any sublayout. The content area (light grey) is the box within the actual items are aligned. The visible area (white) of a layout begins with the first visible display object and ends with the last.</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/uitools/examples/layout/LayoutInformationExample.swf" width="310" height="210" /]</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> layout<span style="color: #000066; font-weight: bold;">.</span>showcase <span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.</span>HLayout<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">shortcut</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Sprite</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Rectangle</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> LayoutInformationExample <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">Sprite</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> LayoutInformationExample<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">x</span> = <span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> layout <span style="color: #000066; font-weight: bold;">:</span> HLayout = hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;x&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">40</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;y&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">40</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;width&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">230</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;minHeight&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">130</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;maxItemsPerRow&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;vRowAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;middle&quot;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;center&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;middle&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; getBoxes<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">12</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>layoutArea<span style="color: #000066; font-weight: bold;">,</span> 0x999999<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>contentArea<span style="color: #000066; font-weight: bold;">,</span> 0xCCCCCC<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>visibleArea<span style="color: #000066; font-weight: bold;">,</span> 0xFFFFFF<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> getBoxes<span style="color: #000000;">&#40;</span>numBoxes <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">random</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> boxes <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> numBoxes<span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; boxes<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #004993;">random</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> boxes<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Rectangle</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">color</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">inflate</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">with</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">graphics</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">color</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div></div>

<h1>Old School API</h1>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/uitools/examples/layout/OldSchoolAPIExample.swf" width="510" height="190" /]</p>

<div class="wp_syntax"><div class="code"><div class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> layout<span style="color: #000066; font-weight: bold;">.</span>showcase <span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.</span>HLayout<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> com<span style="color: #000066; font-weight: bold;">.</span>sibirjak<span style="color: #000066; font-weight: bold;">.</span>ui<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">shortcut</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Sprite</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Rectangle</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> OldSchoolAPIExample <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">Sprite</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> OldSchoolAPIExample<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// layout 1</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> layout <span style="color: #000066; font-weight: bold;">:</span> HLayout = <span style="color: #0033ff; font-weight: bold;">new</span> HLayout<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>minWidth = <span style="color: #000000; font-weight:bold;">220</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>maxContentWidth = <span style="color: #000000; font-weight:bold;">180</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>minHeight = <span style="color: #000000; font-weight:bold;">150</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>hGap = <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>vGap = <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>vRowAlign = <span style="color: #990000;">&quot;justify&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>hAlign = <span style="color: #990000;">&quot;right&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span>getBoxes<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">16</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>contentArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// layout 2</span><br />
&nbsp; &nbsp; &nbsp; layout = hlayout<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; config<span style="color: #000000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;x&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">260</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;y&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;minWidth&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">220</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;maxContentWidth&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">180</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;minHeight&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">150</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;vGap&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;vRowAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;justify&quot;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">&quot;hAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;right&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; getBoxes<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">16</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; layout<span style="color: #000066; font-weight: bold;">.</span>layout<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>layout<span style="color: #000066; font-weight: bold;">.</span>contentArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> getBoxes<span style="color: #000000;">&#40;</span>numBoxes <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">random</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Boolean</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> boxes <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> numBoxes<span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; boxes<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> Box<span style="color: #000000;">&#40;</span><span style="color: #004993;">random</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> boxes<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Rectangle</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000000;">&#41;</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">inflate</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">with</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">graphics</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>0x333333<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">rect</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div></div>

]]></content:encoded>
			<wfw:commentRss>http://sibirjak.com/osflash/blog/announcement-layouts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling text fields in Flash with the Jakute CSS framework</title>
		<link>http://sibirjak.com/osflash/blog/styling-text-fields-with-css/</link>
		<comments>http://sibirjak.com/osflash/blog/styling-text-fields-with-css/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 00:54:45 +0000</pubDate>
		<dc:creator>Jens Struwe</dc:creator>
				<category><![CDATA[Jakute]]></category>

		<guid isPermaLink="false">http://sibirjak.com/osflash/?p=1519</guid>
		<description><![CDATA[I just have added a new Jakute Styling Engine example: . The example shows pretty compact the possibilities of the framework and is a good starting point to get involved. There are three Flash TextField objects added to the stage without any configuration. [Example url="/var/www/jes/sibirjak_com_git/Jakute-Styling-Engine/examples/features/textfield/TextFieldStyles.as" /] A (so called) type adapter realizes the communication between [...]]]></description>
			<content:encoded><![CDATA[<p>I just have added a new Jakute Styling Engine example: <a href="http://sibirjak.com/osflash/projects/jakute-styling-engine/examples/text_fields/">Styling text fields with CSS</a>. The example shows pretty compact the possibilities of the framework and is a good starting point to get involved.</p>
<p>There are three Flash <code>TextField</code> objects added to the stage without any configuration.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/Jakute-Styling-Engine/examples/features/textfield/TextFieldStyles.as" /]</p>
<p>A (so called) type adapter realizes the communication between a particular text field and Jakute. There is some state handling built in.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/Jakute-Styling-Engine/examples/features/textfield/TextFieldAdapter.as" /]</p>
<p>An external CSS style sheet assigns different formattings and behaviors to the text fields.</p>
<p>[Example url="/var/www/jes/sibirjak_com_git/Jakute-Styling-Engine/examples/features/textfield/TextFieldStylesCSS.as" /]</p>
<p>The compiled movie:</p>
<p>[SWFExample example="http://sibirjak.com/osflash/wp-content/uploads/jakute/examples/features/textfield/TextFieldStyles.swf" width="320" height="120" /]</p>
<p>Please checkout the <a href="http://sibirjak.com/osflash/projects/jakute-styling-engine/documentation/">documentation</a> on further information on style management in Flash with Jakute Styling Engine.</p>
]]></content:encoded>
			<wfw:commentRss>http://sibirjak.com/osflash/blog/styling-text-fields-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with focus, tabbing and IE</title>
		<link>http://sibirjak.com/osflash/blog/fun-with-focus-tabbing-and-ie/</link>
		<comments>http://sibirjak.com/osflash/blog/fun-with-focus-tabbing-and-ie/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 17:14:15 +0000</pubDate>
		<dc:creator>Jens Struwe</dc:creator>
				<category><![CDATA[ActionScript]]></category>

		<guid isPermaLink="false">http://sibirjak.com/osflash/?p=1488</guid>
		<description><![CDATA[If you ever have tried to create a circular tab loop with native ActionScript you apparently forgot to provide your insights the community. Anyway, I couldn&#8217;t find any related, since the web searches coughed up everything to Flash and Flex but not AS. Well, what is this article about? Implementing a tab loop seems to [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever have tried to create a circular tab loop with native ActionScript you apparently forgot to provide your insights the community. Anyway, I couldn&#8217;t find any related, since the web searches coughed up everything to Flash and Flex but not AS.</p>
<p>Well, what is this article about? Implementing a tab loop seems to be pretty easy. We make our compoents to be tab-enabled and are done. Unfortunately, it isn&#8217;t that simple. There is a trap we may fall into with the Internet Explorer&#8217;s default swf parameter <code>seamlessTabbing</code>. The parameter is described in the <a href="http://www.adobe.com/support/documentation/en/flashplayer/7/releasenotes.html">Flash Player 7 release notes</a>. It is set to true by default and makes sure that a flash movie appears in the regular tab order of the browser window. If we hit TAB in a swf application, the focus moves either to the next focusable element within the swf or to the next browser element such as a button, link or even the URL bar.</p>
<p>It is actually pretty unclear, under which conditions the focus leaves the movie. To understand the problem, I have written a <a href="http://sibirjak.com/projects/jsdk/focustests/focustest.php">small test application</a>. In this article I will explain what the keyboard focus in Flash depends on.</p>
<h1>The test application</h1>
<p>This is a PHP page with a form containing some configuration variables for the embedded movie. The movie appears three times in this page to be able to test the focus of multiple Flash objects. Above and below the movies are HTML buttons that may be clicked to set the focus on and watch the tab loop by hitting TAB repeatedly.</p>
<p>The <a href="https://github.com/AS3Commons/as3commons-ui/tree/master/examples/focus/funwithfocus">PHP and ActionScript sources</a> are available on GitHub.</p>
<table class="simple_table">
<tr>
<td>Number of boxes:</td>
<td>The number of boxes appearing in the test application.</td>
</tr>
<tr>
<td>Number of tab-enabled boxes:</td>
<td>The number of appearing boxes that have their tabEnabled property set to true.</td>
</tr>
<tr>
<td>Seamless tabbing:</td>
<td>SWF object paramter. In IE true by default. Does not have effect to Firefox.</td>
</tr>
<tr>
<td>Prevent focus change:</td>
<td>If set to true, KEY_FOCUS_CHANGE events are blocked using focusEvent.preventDefault().</td>
</tr>
<tr>
<td>Set default focus to stage:</td>
<td>If set to true, the test application will focus the stage in any case the focus of a focused object is lost.</td>
</tr>
</table>
<p>You should test the different configuration parameters in at least Firefox and IE.</p>
<h1>The test results</h1>
<h2>Firefox: Tab loop ignores Flash movies</h2>
<p>Test: Click one of the buttons above the movies and hit TAB multiple times. Change properties and do it again.</p>
<p>Link: <a href="http://sibirjak.com/projects/jsdk/focustests/focustest.php">Test 1</a><br />
Configuration: <code>seamlessTabbing=true, preventDefault=false, focusToStage=false</code></p>
<p>Note: This is what we expect.</p>
<h2>IE: Tab loop broken with movies without tab-enabled children</h2>
<p>Test: Click one of the buttons above the movies and hit TAB multiple times.</p>
<p>Link: <a href="http://sibirjak.com/projects/jsdk/focustests/focustest.php?num_boxes=3&#038;num_tab_enabled_boxes=0">Test 2</a><br />
Configuration: <code>seamlessTabbing=true, preventDefault=false, focusToStage=false</code></p>
<h2>IE: Tab loop correct with movies that contain tab-enabled children</h2>
<p>Test: Click one of the buttons above the movies and hit TAB multiple times.</p>
<p>Link: <a href="http://sibirjak.com/projects/jsdk/focustests/focustest.php?num_boxes=6&#038;num_tab_enabled_boxes=3">Test 3</a><br />
Configuration: <code>seamlessTabbing=true, preventDefault=false, focusToStage=false</code></p>
<h2>IE: Tab loop stops with the first movie when <code>seamlessTabbing=false</code></h2>
<p>Test: Click one of the buttons above the movies and hit TAB multiple times.</p>
<p>Link: <a href="http://sibirjak.com/projects/jsdk/focustests/focustest.php?num_boxes=6&#038;num_tab_enabled_boxes=3&#038;seamless=false">Test 4</a><br />
Configuration: <code>seamlessTabbing=false, preventDefault=false, focusToStage=false</code></p>
<p>Note: We would rather expect the loop to ignore the movies.</p>
<h2>IE: Tab loop stops with the first movie when focus events blocked</h2>
<p>Test: Click one of the buttons above the movies and hit TAB multiple times.</p>
<p>Link: <a href="http://sibirjak.com/projects/jsdk/focustests/focustest.php?num_boxes=6&#038;num_tab_enabled_boxes=3&#038;prevent_default=true">Test 5</a><br />
Configuration: <code>seamlessTabbing=true, preventDefault=true, focusToStage=false</code></p>
<p>Note: This is the same behavior as with <code>seamlessTabbing=false</code>.</p>
<h2>IE: Focus moves out of movie even when focus events blocked</h2>
<p>Test: Click the last tab-enabled child of a movie. Then click the movie&#8217;s stage or a not tab-enabled child. Hit TAB. The focus leaves the movie.</p>
<p>Link: <a href="http://sibirjak.com/projects/jsdk/focustests/focustest.php?num_boxes=6&#038;num_tab_enabled_boxes=3&#038;prevent_default=true">Test 6</a><br />
Configuration: <code>seamlessTabbing=true, preventDefault=true, focusToStage=false</code></p>
<p>Note: The focus should actually not move out. Apparently the player stores the last focused item which tab-enabled property is set to true. When we then hit TAB and no item is currently in focus, the player checks, if the stored child has a successor that can be focused. If there is none, it releases the movie focus.</p>
<h2>IE: Flash loses focus to the browser without any tab-enabled child</h2>
<p>Test: Click into a movie. The movie activates. Hit TAB. The focus moves out.</p>
<p>Link: <a href="http://sibirjak.com/projects/jsdk/focustests/focustest.php?num_boxes=6&#038;num_tab_enabled_boxes=0">Test 7</a><br />
Configuration: <code>seamlessTabbing=true, preventDefault=*, focusToStage=*</code></p>
<p>Note: To keep the focus in the movie, we at least need one child with <code>tabEnabled</code> set to true.</p>
<h2>IE: Focus stays in movie if default focus is set to the stage</h2>
<p>Test: Click the last tab-enabled child of a movie. Then click the movie&#8217;s stage or a not tab-enabled child. Hit TAB. The focus stays in the movie.</p>
<p>Link: <a href="http://sibirjak.com/projects/jsdk/focustests/focustest.php?num_boxes=6&#038;num_tab_enabled_boxes=3&#038;prevent_default=true&#038;focus_to_stage=true">Test 8</a><br />
Configuration: <code>seamlessTabbing=true, preventDefault=true, focusToStage=true</code></p>
<h1>Summary</h1>
<p>Managing the application&#8217;s focus could be quite easy if we wouldn&#8217;t have to consider the seammless tabbing capabilities of Active-X players. When we develop third party solutions, we simply cannot rely on a property that is set to the embedding HTML container.</p>
<h2>Workaround 1</h2>
<p>To circumvent the problem we might cancel the <code>KEY_FOCUS_CHANGE</code> event. However, even this does not cover all possible situations. A workaround seems to be to set the stage&#8217;s focus to the stage itself in the case the focus is not gained by any child object. Anyway, we need to set at least one child to be tab enabled.</p>
<h2>Workaround 2</h2>
<p>Another workaround involves 2 tab-enabled <code>Sprite</code> instances that never receive focus and do not contain visible content. Internally, the Flash Player would treat them as possible focus targets and therefore wouldn&#8217;t release the movie&#8217;s focus.</p>
<p>Note, in both cases we need to default prevent the standard focus change events and implement our own focus management.</p>
]]></content:encoded>
			<wfw:commentRss>http://sibirjak.com/osflash/blog/fun-with-focus-tabbing-and-ie/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
