<?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>Mihai Corlan &#187; Mobile</title>
	<atom:link href="http://corlan.org/category/mobile/feed/" rel="self" type="application/rss+xml" />
	<link>http://corlan.org</link>
	<description>Web, Mobile, and Rock&#38;Roll</description>
	<lastBuildDate>Mon, 30 Jan 2012 11:01:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Native Extensions examples available now</title>
		<link>http://corlan.org/2011/09/22/native-extensions-examples-available-now/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=native-extensions-examples-available-now</link>
		<comments>http://corlan.org/2011/09/22/native-extensions-examples-available-now/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 14:46:37 +0000</pubDate>
		<dc:creator>Mihai Corlan</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://corlan.org/?p=3218</guid>
		<description><![CDATA[
			
				
			
		
Among of the biggest news of the Adobe AIR 3 release  is the Native Extensions feature. If you want to get started with this, or maybe just try it, you should check out the Native Extensions page on Adobe Developer Connection.
There are five examples so far:

Gyroscope (iOS/Android)
NetworkInfo (iOS) &#8211; retrieves information about the network interfaces [...]]]></description>
			<content:encoded><![CDATA[<div class="none" style="float: right; margin-left: 10px;"><g:plusone href="http://corlan.org/2011/09/22/native-extensions-examples-available-now/" size="tall" count="true"></g:plusone></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fcorlan.org%2F2011%2F09%2F22%2Fnative-extensions-examples-available-now%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcorlan.org%2F2011%2F09%2F22%2Fnative-extensions-examples-available-now%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Among of the biggest news of the Adobe AIR 3 release  is the <a href="http://www.adobe.com/devnet/air/articles/extending-air.html">Native Extensions</a> feature. If you want to get started with this, or maybe just try it, you should check out the Native Extensions <a href="http://www.adobe.com/devnet/air/native-extensions-for-air.html">page</a> on Adobe Developer Connection.</p>
<p>There are five examples so far:</p>
<ol>
<li><a href="http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/gyroscope.html">Gyroscope</a> (iOS/Android)</li>
<li><a href="http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/networkinfo.html">NetworkInfo</a> (iOS) &#8211; retrieves information about the network interfaces on an iOS device</li>
<li><a href="http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/vibration.html">Vibration</a> (iOS/Android) &#8211; make the device vibrate</li>
<li><a href="http://custardbelly.com/blog/2011/09/21/air-native-extension-example-ibattery-for-ios/">iBattery</a> (iOS) &#8211; gets the battery status (unknown, unplugged, charging, or full) of an iOS device</li>
<li><a href="http://blog.magicalhobo.com/2011/09/12/air-3-native-extension-imageprocessor/">.NET Image Encoder</a> (Windows) &#8211; encodes a bitmap into BMP, JPEG, or PNG format using Microsoft .NET Framework 4</li>
</ol>
<p>The first three extensions were created by Adobe engineers, the last two by community. As I said before I&#8217;m looking forward to seeing many more extensions created and having a central place to go for all of them.</p>
]]></content:encoded>
			<wfw:commentRss>http://corlan.org/2011/09/22/native-extensions-examples-available-now/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building an iPad game with Adobe AIR in a week</title>
		<link>http://corlan.org/2011/08/30/building-an-ipad-game-with-adobe-air-in-a-week/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=building-an-ipad-game-with-adobe-air-in-a-week</link>
		<comments>http://corlan.org/2011/08/30/building-an-ipad-game-with-adobe-air-in-a-week/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 12:29:42 +0000</pubDate>
		<dc:creator>Mihai Corlan</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://corlan.org/?p=3173</guid>
		<description><![CDATA[
			
				
			
		
Radu Ticiu of Timisoara Mobile Development Group invited me to speak at their August event about Adobe&#8217;s solutions for mobile development. And I must say I&#8217;m glad I accepted. Not only because the event and the people were great but because the other speaker was quite interesting.
Stefan is his name and he runs one of [...]]]></description>
			<content:encoded><![CDATA[<div class="none" style="float: right; margin-left: 10px;"><g:plusone href="http://corlan.org/2011/08/30/building-an-ipad-game-with-adobe-air-in-a-week/" size="tall" count="true"></g:plusone></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F30%2Fbuilding-an-ipad-game-with-adobe-air-in-a-week%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F30%2Fbuilding-an-ipad-game-with-adobe-air-in-a-week%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Radu Ticiu of <a href="http://www.meetup.com/TiMoDev/">Timisoara Mobile Development Group</a> invited me to speak at their August event about Adobe&#8217;s solutions for mobile development. And I must say I&#8217;m glad I accepted. Not only because the event and the people were great but because the other speaker was quite interesting.</p>
<p>Stefan is his name and he runs one of the most creative <a href="http://wearex3.com/">companies</a> in this part of the world. Just to give you some context: they&#8217;ve won three <a href="http://www.thefwa.com/">FWA</a> awards so far. His presentation was about the making off of an iPad game using Adobe AIR and Flash Builder 4.5. So far nothing new or extraordinary. isn&#8217;t it?</p>
<p>Well what really caught my attention were these facts:</p>
<ul>
<li>While they had great expertise in building Flash applications for the desktop, this was the first project they&#8217;ve done for mobile.</li>
<li>They completed the game from concept to final IPA file ready for publishing in a week.</li>
<li>The team who built this consisted of one designer, one developer, and Stefan.</li>
</ul>
<p><span id="more-3173"></span></p>
<p>Here are some screen shots of their game &#8211; called <a href="http://itunes.apple.com/ro/app/chemistry-brothers/id451480299?mt=8">Chemistry Brothers</a>:</p>
<p><img class="alignnone size-full wp-image-3174" title="chemistry-brothers-1" src="http://corlan.org/wp-content/uploads/2011/08/chemistry-brothers-1.jpg" alt="" width="480" height="360" /></p>
<p><img class="alignnone size-full wp-image-3175" title="chemistry-brothers-2" src="http://corlan.org/wp-content/uploads/2011/08/chemistry-brothers-2.jpg" alt="" width="480" height="360" /></p>
<p>During the presentation (and after while we enjoyed some beer and food) I learned more about this project and the company. And I think this project and the way they approached it is a good example of how you can get into mobile development if you are a web or desktop developer.</p>
<p>These were Stefan&#8217;s challenges before deciding to start the project:</p>
<ul>
<li>no expertise in mobile development</li>
<li>no expertise in Flash and AIR mobile development</li>
<li>no expertise in selling an application on Apple&#8217;s app store</li>
</ul>
<p>Though these challenges were quite big he had something to rely on:</p>
<ul>
<li>tons of creativity</li>
<li>great expertise in desktop and web development including Flash and Adobe AIR</li>
<li>a plan</li>
</ul>
<p>The plan he had was as important as the skills of his team. First of all, he decided to spend a week for building the game, from nothing to the polished &#8220;thing&#8221; you can find in app store. It was an all-or-nothing kind of bet. And to increase the chances of success he took his team out of the town to a remote town with nothing to distract them. They did a sort of software bootcamp.</p>
<p>Second, from the beginning he didn&#8217;t want to have anything less than great performances. To ensure this they used a first generation iPad for testing the code and they targeted 30 frames per second for their game. Anything less was not accepted.</p>
<p>Third, they struck a fine balance between the &#8220;features&#8221; of this game. They spent a lot of time on the graphics and game story but they didn&#8217;t spend much time on building lots of levels. It would have been impossible to do all those things with such restrictions (three people and one week).</p>
<p>And finally, they did a kind of agile development not for the code but for the product (game). Remember that I said they didn&#8217;t have any prior experience in building and selling mobile applications. So their plan was to build the game in one week and then ship it. If it had success then they would continue to develop as they already had the game story and lots of ideas. Guess what? They are happy with how the game is selling so far. Stefan told me that they will continue this project.</p>
<p>If you are one of the people who couldn&#8217;t find time for trying mobile development so far you are not alone. And more importantly, it is not so difficult to make your first move. Just think of an application that you&#8217;d like to build and make sure you allocate time for this. It could be a series of weekends during a month or three days of your vacation. It really doesn&#8217;t matter. What matters is to be focused and work on this fully committed. Chances are that you&#8217;d be surprised by yourself and what you can do.</p>
<p>In the end I just want to share some pictures from their office. Some say that having a creative environment stimulates creativity. After talking to Stefan and seeing his company&#8217;s work I&#8217;m not sure about this anymore. It looks like creative people change ordinary things into something to remember.</p>
<div id="attachment_3176" class="wp-caption alignnone" style="width: 600px"><img class="size-full wp-image-3176" title="A wall built out of books" src="http://corlan.org/wp-content/uploads/2011/08/1.jpg" alt="A wall built out of books" width="590" height="443" /><p class="wp-caption-text">A wall built out of books</p></div>
<div id="attachment_3177" class="wp-caption alignnone" style="width: 600px"><img class="size-full wp-image-3177" title="Playing around with Dark Vader's helmet " src="http://corlan.org/wp-content/uploads/2011/08/3.jpg" alt="Playing around with Dark Vader's helmet" width="590" height="443" /><p class="wp-caption-text">Playing around with Darth Vader&#39;s helmet</p></div>
<div id="attachment_3178" class="wp-caption alignnone" style="width: 600px"><img class="size-full wp-image-3178" title="Another inspirational wall closely guarded by a she-clone" src="http://corlan.org/wp-content/uploads/2011/08/12.jpg" alt="Another inspirational wall closely guarded by a she-clone" width="590" height="443" /><p class="wp-caption-text">Another inspirational wall closely guarded by a she-clone</p></div>
<div id="attachment_3179" class="wp-caption alignnone" style="width: 453px"><img class="size-full wp-image-3179" title="Rest room guardian!" src="http://corlan.org/wp-content/uploads/2011/08/4.jpg" alt="Rest room guardian!" width="443" height="590" /><p class="wp-caption-text">Rest room guardian!</p></div>
<div id="attachment_3180" class="wp-caption alignnone" style="width: 600px"><img class="size-full wp-image-3180" title="Taking a break or having a meeting in a cozy space" src="http://corlan.org/wp-content/uploads/2011/08/5.jpg" alt="Taking a break or having a meeting in a cozy space" width="590" height="443" /><p class="wp-caption-text">Taking a break or having a meeting in a cozy space</p></div>
<p>If you have similar stories or just want to talk back, don&#8217;t hesitate to use the comments :). All I can say is: Bravo Stefan &amp; Company!</p>
]]></content:encoded>
			<wfw:commentRss>http://corlan.org/2011/08/30/building-an-ipad-game-with-adobe-air-in-a-week/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Flex Mobile Development: skinning the ActionBar component</title>
		<link>http://corlan.org/2011/08/29/flex-mobile-development-skinning-the-actionbar-component/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flex-mobile-development-skinning-the-actionbar-component</link>
		<comments>http://corlan.org/2011/08/29/flex-mobile-development-skinning-the-actionbar-component/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 06:00:14 +0000</pubDate>
		<dc:creator>Mihai Corlan</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://corlan.org/?p=3142</guid>
		<description><![CDATA[
			
				
			
		
One of the important pieces of the Flex framework for mobile development is the ActionBar class. This class lets you create an application title bar with three distinct areas. Starting from left to right you can have a navigation area, a title area, and an actions area. Of course you are not forced to use [...]]]></description>
			<content:encoded><![CDATA[<div class="none" style="float: right; margin-left: 10px;"><g:plusone href="http://corlan.org/2011/08/29/flex-mobile-development-skinning-the-actionbar-component/" size="tall" count="true"></g:plusone></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F29%2Fflex-mobile-development-skinning-the-actionbar-component%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F29%2Fflex-mobile-development-skinning-the-actionbar-component%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>One of the important pieces of the Flex framework for mobile development is the <em><a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/ActionBar.html">ActionBar</a></em> class. This class lets you create an application title bar with three distinct areas. Starting from left to right you can have a navigation area, a title area, and an actions area. Of course you are not forced to use all these areas.</p>
<p>Why would you want to use this component? There are many reasons for using it but probably the most important is that it is an established user interaction design pattern on Android and iOS. This is how you usually add things like an application or section title, navigation buttons, search input texts, or action buttons.</p>
<p><span id="more-3142"></span></p>
<p>Here are two screen shots of the Facebook application running on Android and iOS that illustrates this idea:</p>
<p><img class="alignnone size-full wp-image-3148" title="actionbar1" src="http://corlan.org/wp-content/uploads/2011/08/actionbar11.png" alt="" width="270" height="388" /> <img class="alignnone size-full wp-image-3149" title="actionbar2" src="http://corlan.org/wp-content/uploads/2011/08/actionbar2.png" alt="" width="270" height="388" /></p>
<h2>Using the ActionBar component</h2>
<p>Using the <em>ActionBar</em> component is quite easy. First, you&#8217;ll need to create a Flex mobile project that uses either <em>ViewNavigatorApplication</em> or <em>TabbedViewNavigatorApplication</em>. Then, you can define the components you want to add to the <em>ActionBar</em> either globally (for all the <em>Views)</em> or individually (for each <em>View)</em>.</p>
<p>If you want to add them inside of a <em>View</em> here is how you do it:</p>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"&gt;

 &lt;s:navigationContent&gt;
     &lt;s:Button label="Back"/&gt;
 &lt;/s:navigationContent&gt;
 &lt;s:titleContent&gt;
     &lt;s:TextInput prompt="type to search" width="100%"/&gt;
 &lt;/s:titleContent&gt;
 &lt;s:actionContent&gt;
     &lt;s:Button label="+"/&gt;
 &lt;/s:actionContent&gt;

&lt;/s:View&gt;</pre>
<p>This code produces the following <em>ActionBar</em>:</p>
<p><img class="alignnone size-full wp-image-3151" title="actionbar3" src="http://corlan.org/wp-content/uploads/2011/08/actionbar3.png" alt="" width="270" height="233" /></p>
<p>If you want to set it globally then the method differe slightly depending on what Application root tag you chose when creating the project (<em>ViewNavigatorApplication</em> or <em>TabbedViewNavigatorApplication</em>). For <em>ViewNavigatorApplication</em> you&#8217;d do something like this:</p>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       firstView="views.ActionBarHomeView"&gt;

 &lt;s:navigationContent&gt;
      &lt;s:Button label="Back"/&gt;
 &lt;/s:navigationContent&gt;
 &lt;s:titleContent&gt;
      &lt;s:TextInput prompt="type to search" width="100%"/&gt;
 &lt;/s:titleContent&gt;
 &lt;s:actionContent&gt;
      &lt;s:Button label="+"/&gt;
 &lt;/s:actionContent&gt;

&lt;/s:ViewNavigatorApplication&gt;</pre>
<p>And for <em>TabbedViewNavigatorApplication</em> you&#8217;d add one for each tab you have in your application. For example:</p>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"&gt;

 &lt;s:ViewNavigator label="Tab 1" width="100%" height="100%" firstView="views.Tab1View"&gt;
      &lt;s:navigationContent&gt;
           &lt;s:Button label="Back"/&gt;
      &lt;/s:navigationContent&gt;
      &lt;s:titleContent&gt;
           &lt;s:TextInput prompt="type to search" width="100%"/&gt;
      &lt;/s:titleContent&gt;
      &lt;s:actionContent&gt;
           &lt;s:Button label="+"/&gt;
      &lt;/s:actionContent&gt;
 &lt;/s:ViewNavigator&gt;
 &lt;s:ViewNavigator label="Tab 2" width="100%" height="100%" firstView="views.Tab2View"&gt;

 &lt;/s:ViewNavigator&gt;

&lt;/s:TabbedViewNavigatorApplication&gt;</pre>
<p>And here is how this code looks like at runtime:</p>
<p><img class="alignnone size-full wp-image-3154" title="actionbar4" src="http://corlan.org/wp-content/uploads/2011/08/actionbar4.png" alt="" width="270" height="429" /></p>
<p>If you set the <em>ActionBar</em> globally and you want to override a section or all sections in a particular <em>View</em> all you have to do is to set that section/sections in the <em>View.</em></p>
<p>You should also know that you can control the <em>ActionBar</em> visibility and rendering mode. For example in any <em>View</em> in which you want to hide the <em>ActionBar</em> you can set <em>actionBarVisible = false</em>. By default the <em>ActionBar</em> is rendered so it takes up some of the available space for the rest of your application. If you want to have the bar hovering on top of the rest of your application you can set the <em>overlayControls</em> to <em>true</em> in your <em>View</em>.</p>
<h2>Understanding how the ActionBar component works</h2>
<p>Let&#8217;s see how everything is put together. Each part of the <em>ActionBar</em> (navigation, title, and action content) is actually a Spark Group object. If you open the <em>ActionBar</em> class file you&#8217;ll find three properties named: <em>actionGroup</em>, <em>navigationGroup</em>, and <em>titleGroup</em>. These Groups are populated by calling the setter methods: <em>actionContent()</em>, <em>titleContent()</em>, and <em>navigationContent()</em>. These methods are called by the <em>View</em> class to push the components you set for each section and the argument is an Array (you can set a Button or a number of UI components for each section).</p>
<p>How about the layout used by these three groups? Well you can set a different layout than the default by calling the <em>actionLayout</em>, <em>navigationLayout</em>, and <em>titleLayout</em> setters.</p>
<p>The <em>ActionBar</em> component is a Spark component and this means that the task for laying out the various UI components that you can add to each section is actually implemented by a skin class. And of course the look and feel is implemented by the same skin class. The default skin is <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/skins/mobile/ActionBarSkin.html"><em>spark.skins.mobile.ActionBarSkin</em></a>. This class extends the <em>MobileSkin</em> class, which in turns extends the <em>UIComponent</em>.</p>
<p>The interesting parts in the skin class are these three methods: <em>createChildren()</em>, <em>measure()</em>, and <em>layoutContents()</em>.</p>
<p>If you take a look at the <em>createChildren()</em> method you will see that here is where the three groups (<em>navigationGroup</em>, <em>actionGroup</em>, and <em>titleGroup</em>) used for each section are actually created and the default layout is set. Also you can see that the default layout used by each group is <em>HorizontalLayout</em>. Here is a snippet of the code that creates the <em>navigationGroup</em>:</p>
<pre>navigationGroup = new Group();
var hLayout:HorizontalLayout = new HorizontalLayout();
hLayout.horizontalAlign = HorizontalAlign.LEFT;
hLayout.verticalAlign = VerticalAlign.MIDDLE;
hLayout.gap = 0;
hLayout.paddingLeft = hLayout.paddingTop = hLayout.paddingRight
        = hLayout.paddingBottom = 0;
navigationGroup.layout = hLayout;
navigationGroup.id = "navigationGroup";</pre>
<p>The <em>measure()</em> method is executed executed after the <em>createChildren()</em> method or when the <em>invalidateSize()</em> method is executed. As the name implies, this method measures the width and the height of the <em>ActionBar</em> taking into consideration the padding (left, right, top, and bottom) and each group width and height (<em>navigationGroup</em>, <em>titleGroup</em>, and <em>actionGroup</em>). It is important to note that the height of the <em>ActionBar</em> is determined by the highest element you have, if this height is bigger than the default height. In other words if you add a <em>Button</em> and set the height of the button to 200, then the <em>ActionBar</em> height will be 200 pixels.</p>
<p>And finally the <em>layoutContent()</em> method is responsible for positioning and setting the size of each <em>Group</em>. This method positions each group starting from left to right with the <em>navigationGroup</em>, <em>titleGroup</em>, and <em>actionGroup</em>. If the total width of the <em>navigationGroup</em> and <em>actionGroup</em> is equal to or more than the total available width then the <em>titleGroup</em> is not displayed (visible = false).</p>
<p>Here is a graphical representation of how these different parts are related:</p>
<p><img class="alignnone size-full wp-image-3160" title="actiobar6" src="http://corlan.org/wp-content/uploads/2011/08/actiobar6.png" alt="" width="562" height="211" /></p>
<h2>Skinning the ActionBar component</h2>
<p>Let&#8217;s talk about styling the ActionBar component. Out of the box you can quite easily change the appearance using the CSS properties. For example you can use CSS to transform the default look and feel  of the <em>ActionBar</em> presented in a screen shot at the beginning of this article to something like this with a little bit of CSS:</p>
<p><img class="alignnone size-full wp-image-3156" title="actionbar4" src="http://corlan.org/wp-content/uploads/2011/08/actionbar42.png" alt="" width="270" height="74" /></p>
<p>And the CSS code that does this is this (please note that you have to include the CSS code or file in the main application file and not in the <em>Views</em>):</p>
<pre>&lt;fx:Style&gt;
@namespace s "library://ns.adobe.com/flex/spark";</pre>
<pre>s|ActionBar {
      chromeColor: #484877;
      defaultButtonAppearance: beveled;
}
&lt;/fx:Style&gt;</pre>
<p>The second CSS property in the code above (defaultButtonAppearance) is responsible for rendering the buttons in iOS style. If you inspect the <em>ActionBar</em> class you will find all the important CSS properties that you can play with.</p>
<p>If you want to go beyond background and font colors, sizes, and so forth you have to go down the road of creating a custom skin. And the easiest way to do this is to extend the <em>ActionBarSkin</em> class.</p>
<p>Here are the important parts of the <em>ActionBarSkin</em> class from a skinning perspective:</p>
<ul>
<li><em>border</em> and <em>borderClass</em> properties. <em>Border</em> represents the first child of the <em>ActionBarSkin</em> (take a look at the <em>createChildren()</em> method).<em>BorderClass</em> is a reference to an FXG file that is set in the class constructor depending on the <em>applicationDPI</em> value. The <em>borderClass</em> is used for creating the borders of the <em>ActionBar</em> and the shadow at the bottom. Here is a screen shot of what this looks like (I placed a pinkish background behind the graphics to provide some contrast for the highlights you can notice on the left/right side):</li>
</ul>
<p><img class="alignnone size-full wp-image-3158" title="actionbar5" src="http://corlan.org/wp-content/uploads/2011/08/actionbar5.png" alt="" width="350" height="273" /></p>
<ul>
<li><em>drawBackground()</em> method. This method is responsible for drawing the background. In the previous screen shots this is where the black or dark blue color is coming from. If you take a look at this method you will notice that it uses CSS properties (default or set by the programmer) to draw a gradient.</li>
</ul>
<p>I think that in the most of cases, when you want to skin an <em>ActionBar</em> component you&#8217;ll likely modify the <em>drawBackground()</em> method and create a different <em>borderClass</em> FXG file.</p>
<p>Let me show you an example of a custom skinning. There are three steps involved in this.</p>
<p>First, I created a new FXG file to be used for the background. To do this I opened up the FXG file used by default by the <em>ActionBarSkin</em> in Adobe Illustrator (you can find the path for this FXG in the <em>ActionBarSkin</em> constructor). And I added three green rectangles (some with a solid color, others with a transparent gradient). Here is the result in Illustrator:</p>
<p><img class="alignnone size-full wp-image-3165" title="actionbar7" src="http://corlan.org/wp-content/uploads/2011/08/actionbar7.png" alt="" width="297" height="237" /></p>
<p>Then, I exported the FXG file as an FXG. And I opened this file in a text editor to remove some of the tags and attributes introduced by Illustrator. Finally, I add the FXG file to the Flex mobile project.</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;UTF-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;</span>Graphic <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;2.0&quot;</span> xmlns=<span style="color: #990000;">&quot;http://ns.adobe.com/fxg/2008&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; scaleGridLeft=<span style="color: #990000;">&quot;2&quot;</span> scaleGridTop=<span style="color: #990000;">&quot;3&quot;</span> scaleGridRight=<span style="color: #990000;">&quot;88&quot;</span> scaleGridBottom=<span style="color: #990000;">&quot;61&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;2&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;89.8335&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;60&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#16938D&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;0.0830078&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;35&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;89.8335&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;26.6665&quot;</span> <span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>LinearGradient <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;44.9165&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">scaleX</span>=<span style="color: #990000;">&quot;26.6665&quot;</span> <span style="color: #004993;">rotation</span>=<span style="color: #990000;">&quot;90&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0.160132&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#E2E2E2&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.126504&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0.400165&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#A9A9A9&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.31613&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;1&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.79&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>LinearGradient<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;1.89014&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;89.8335&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;21.3774&quot;</span> <span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>LinearGradient <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;44.9165&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;21.3774&quot;</span> <span style="color: #004993;">scaleX</span>=<span style="color: #990000;">&quot;21.3774&quot;</span> <span style="color: #004993;">rotation</span>=<span style="color: #990000;">&quot;270&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;1&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>LinearGradient<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;90&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;2&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.75&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;62&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;90&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;2&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.85&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;64&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;90&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;1&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.35&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;65&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;90&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;1&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.25&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;66&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;90&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;1&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.2&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;67&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;90&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;1&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.15&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;68&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;90&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;1&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.1&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;69&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;90&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;1&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.05&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;1&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;2&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.25&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;88&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;1&quot;</span> <span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;1&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;61&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.1&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;88&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;1&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;2&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;1&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;60&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>LinearGradient <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;0.5&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">scaleX</span>=<span style="color: #990000;">&quot;60&quot;</span> <span style="color: #004993;">rotation</span>=<span style="color: #990000;">&quot;90&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.25&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;1&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.1&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>LinearGradient<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;89&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;2&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;1&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;60&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>LinearGradient <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;0.5&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">scaleX</span>=<span style="color: #990000;">&quot;60&quot;</span> <span style="color: #004993;">rotation</span>=<span style="color: #990000;">&quot;90&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.25&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;1&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.1&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>LinearGradient<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;90&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;70&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColor <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;/</span>Graphic<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
</ol>
</div>
<p>Second, I created a new ActionScript class that extends the <em>ActionBarkSkin</em>. In the constructor I make sure that the <em>borderClass</em> uses the FXG file I created in the previous step. And I overrode the <em>drawBackground()</em> method because the FXG file does everything I need. Here is the complete listing:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #9900cc; font-weight: bold;">package</span> org<span style="color: #000066; font-weight: bold;">.</span>corlan<span style="color: #000066; font-weight: bold;">.</span>skins <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> spark<span style="color: #000066; font-weight: bold;">.</span>skins<span style="color: #000066; font-weight: bold;">.</span>mobile<span style="color: #000066; font-weight: bold;">.</span>ActionBarSkin<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> CustomActionBarSkin <span style="color: #0033ff; font-weight: bold;">extends</span> ActionBarSkin <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomActionBarSkin<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//backgroundActionBar is the name of the FXG file</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; borderClass = backgroundActionBar<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> drawBackground<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div>
</li>
</ol>
</div>
<p>Third, I changed the CSS from the main application file in order to set the new skin class as the <em>ActionBar</em> skin class, and the chromeColor used for the buttons. Here is the code:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>ViewNavigatorApplication xmlns<span style="color: #000066; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp;xmlns<span style="color: #000066; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp;firstView=<span style="color: #990000;">&quot;views.ActionBarHomeView&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;</span>fx<span style="color: #000066; font-weight: bold;">:</span>Style<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; @<span style="color: #004993;">namespace</span> s <span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; s<span style="color: #000066; font-weight: bold;">|</span>ActionBar <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chromeColor<span style="color: #000066; font-weight: bold;">:</span> #16938D<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; defaultButtonAppearance<span style="color: #000066; font-weight: bold;">:</span> beveled<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; skinClass<span style="color: #000066; font-weight: bold;">:</span> ClassReference<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;org.corlan.skins.CustomActionBarSkin&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;/</span>fx<span style="color: #000066; font-weight: bold;">:</span>Style<span style="color: #000066; font-weight: bold;">&gt;</span> &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>ViewNavigatorApplication<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
</ol>
</div>
<p>Finally, here is how the skinned <em>ActionBar</em> at runtime:</p>
<p><img class="alignnone size-full wp-image-3166" title="actionbar8" src="http://corlan.org/wp-content/uploads/2011/08/actionbar8.png" alt="" width="483" height="168" /></p>
<p>In conclusion, if you couple these techniques with skinning of the other components you plan to use inside the <em>ActionBar</em> then you can really get something that is quite unique.</p>
<p>You can download the Flex project source code used for this example from <a href="http://corlan.org/downloads/ActionBar.fxp">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://corlan.org/2011/08/29/flex-mobile-development-skinning-the-actionbar-component/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Flex Mobile Development: pay attention to list.itemRenderFunction</title>
		<link>http://corlan.org/2011/08/23/flex-mobile-development-pay-attention-to-list-itemrenderfunction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flex-mobile-development-pay-attention-to-list-itemrenderfunction</link>
		<comments>http://corlan.org/2011/08/23/flex-mobile-development-pay-attention-to-list-itemrenderfunction/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 11:15:58 +0000</pubDate>
		<dc:creator>Mihai Corlan</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://corlan.org/?p=3133</guid>
		<description><![CDATA[
			
				
			
		
A colleague of mine who is building a Flex mobile application had some performance issues with a list. In short, when he used a pretty heavy custom item renderer (with checkboxes, buttons, and labels) the scrolling performance dropped a lot. When using just a label item renderer everything worked well.
So, we started to debug the [...]]]></description>
			<content:encoded><![CDATA[<div class="none" style="float: right; margin-left: 10px;"><g:plusone href="http://corlan.org/2011/08/23/flex-mobile-development-pay-attention-to-list-itemrenderfunction/" size="tall" count="true"></g:plusone></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F23%2Fflex-mobile-development-pay-attention-to-list-itemrenderfunction%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F23%2Fflex-mobile-development-pay-attention-to-list-itemrenderfunction%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>A colleague of mine who is building a Flex mobile application had some performance issues with a list. In short, when he used a pretty heavy custom item renderer (with checkboxes, buttons, and labels) the scrolling performance dropped a lot. When using just a label item renderer everything worked well.</p>
<p>So, we started to debug the code and, as I suspected, the culprit was the layout manager: the virtualization was off.</p>
<p>This was strange as he didn&#8217;t turn off the <em>useVirtualLayout</em> flag anywhere in the code &#8211; at least not explicitly. So why was the virtualization off? Because he used <em>list.itemRenderFunction</em> to change the item renderer at runtime. If you take a look at the documentation you will find this:</p>
<blockquote><p>Function that returns an item renderer IFactory for a specific item. You should define an item renderer function similar to this sample function:</p>
<p><em>function myItemRendererFunction(item:Object):IFactory</em></p>
<p><strong>Currently, when using itemRendererFunction with a virtual layout (useVirtualLayout=true), item renderer recycling is turned off. Because of this, using <em>itemRendererFunction</em> can cause a performance degradation and is not recommended for mobile. This may be fixed in future versions of Flex.</strong></p></blockquote>
<p>So, if you use a heavy item renderer and/or you have many items, don&#8217;t set the item renderer using the <em>itemRendererFunction</em> method.</p>
<p>Instead, you can wrap your custom item renderer in a <em>ClassFactory</em> object and then assign this object to the <em>list.itemRenderer</em> property. Like this:</p>
<pre>var factory:ClassFactory = new ClassFactory(MyCustomItemRenderer);
// set the properties for custom item renderer
factory.properties = {iconField:"thumbnailSmall",
                  messageField:"description", iconHeight:180, iconWidth:180};
// set the ClassFactory object as the list item renderer
myList.itemRenderer = factory;</pre>
<p>There is one more thing. In the example above I used the properties property of the ClassFactory object to set the properties I needed (for example what data property should be used for the message label). You can&#8217;t use this approach for setting CSS properties like fontSize. The only solution I found so far is to create setters that behind the scenes are doing something like this:</p>
<pre>public class MyCustomItemRenderer {
   //...

   public function set fontSize(value:int):void {
      setStyle("fontSize", value);
   }

   //...
}</pre>
<p>This was my tip of the week. And don&#8217;t forget, stay away from <em>useVirtualLayout</em> = false;</p>
]]></content:encoded>
			<wfw:commentRss>http://corlan.org/2011/08/23/flex-mobile-development-pay-attention-to-list-itemrenderfunction/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Flex Mobile Development: storing data locally</title>
		<link>http://corlan.org/2011/08/18/flex-mobile-development-storing-data-locally/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flex-mobile-development-storing-data-locally</link>
		<comments>http://corlan.org/2011/08/18/flex-mobile-development-storing-data-locally/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 08:57:12 +0000</pubDate>
		<dc:creator>Mihai Corlan</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://corlan.org/?p=3117</guid>
		<description><![CDATA[
			
				
			
		
One way to improve the user experience for mobile applications is to save data locally. This technique is important for desktop applications and it is even more important for mobile applications (mostly because the network connection is expensive, slower, or intermittent).
When using applications such as mail or Twitter clients local storage enables users to see [...]]]></description>
			<content:encoded><![CDATA[<div class="none" style="float: right; margin-left: 10px;"><g:plusone href="http://corlan.org/2011/08/18/flex-mobile-development-storing-data-locally/" size="tall" count="true"></g:plusone></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F18%2Fflex-mobile-development-storing-data-locally%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F18%2Fflex-mobile-development-storing-data-locally%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>One way to improve the user experience for mobile applications is to save data locally. This technique is important for desktop applications and it is even more important for mobile applications (mostly because the network connection is expensive, slower, or intermittent).</p>
<p>When using applications such as mail or Twitter clients local storage enables users to see the messages or tweets loaded in the previous session. And while you are seeing these &#8220;old&#8221; items the application can pull in newer items behind the scenes. The main idea is to not to make the user stare at an empty screen each time he opens your application.</p>
<p>A second benefit of this technique is that your application will feel much more responsive. As I said it is possible that the user has a slow Internet connection and downloading 12 small pictures and some descriptions could be visibly slow. Local storage can offer a &#8220;performance&#8221; boost especially for applications that access data that changes rarely.</p>
<p>Depending on your specific use case you may want to save locally:</p>
<ul>
<li>media assets (images, MP3 files, video files)</li>
<li>text or HTML resources</li>
<li>XML files</li>
<li>ActionScript data structures (an array of ActionScript value objects for example)</li>
</ul>
<p><span id="more-3117"></span></p>
<p>So how can you store data locally in an AIR mobile application (Android, PlayBook, and iOS)? You have almost the same methods as in AIR desktop applications (on the desktop you can use the encrypted local store to save ActionScript objects):</p>
<ul>
<li>Use the embedded SQLite database &#8211; obviously perfect for data that are a good match for a relational database</li>
<li>Save ActionScript objects or collections of objects in files &#8211; serialize the objects into a file and read back when needed. Or you can use <em>SharedObject</em> to do the same</li>
<li>Save binary assets directly into files &#8211; perfect for saving images or videos locally</li>
</ul>
<p>I won&#8217;t go into details about these three techniques. Almost three years ago I wrote a <a href="http://corlan.org/2008/09/02/storing-data-locally-in-air/">blogpost</a> that explains each technique (back then it was only AIR for desktops, but remember that apart from the encrypted local store you can use the same approach on mobile or desktop). So click <a href="http://corlan.org/2008/09/02/storing-data-locally-in-air/">here</a> if you want to learn how to use these techniques.</p>
<p>There is one aspect I do want to highlight, however. When you want to save data locally using files you should always use the application storage folder. This folder is outside of the application installation folder. So you can update the application without worrying about the saved data. Here is a simple example for creating a new file inside the application storage folder:</p>
<pre>var file:File = File.applicationStorageDirectory.resolvePath("new-file.png");
var fileStream:FileStream = new FileStream();
fileStrean.open(file, FileMode.WRITE);
fileStream.writeBytes(data, 0, data.length);
fileStream.close()</pre>
<h2>Flex mobile support for persistence</h2>
<p>You probably already know about the persistence support of the Flex mobile framework. If you save your information to the <em>data</em> property of your <em>View</em> pages and set the <em>persistNavigatorState </em>attribute in the main application file to <em>true</em>, then all the information will be automatically saved when the application is closed and restored when the application is re-opened.</p>
<p>So here is a simple example. Suppose that you use this data model in your application:</p>
<pre>package {

[Bindable]     
class User {
    public var firstName:String;
    public var lastName:String;   
}
}</pre>
<p>Next, you turn on the persistence support in the main application file:</p>
<pre>&lt;s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    firstView="views.HomeView"
    <strong>persistNavigatorState="true"</strong>/&gt;</pre>
<p>And finally you use the <em>data</em> property to save the current instance of <em>User</em>. Bellow is the first <em>View</em> of the application. It uses bidirectional binding for displaying the <em>User</em> first name and last name properties.</p>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
   xmlns:s="library://ns.adobe.com/flex/spark"
   title="HomeView"
   viewActivate="onViewActivated()"&gt;
&lt;fx:Script&gt;
 &lt;![CDATA[

   private function onViewActivated():void {
      // if it is the first time the application runs t
      // here is no data
      if (!data) {
         // create a new User instance and
         // save it to data property
         data = new User();
      }
   }

 ]]&gt;
&lt;/fx:Script&gt;
 &lt;s:layout&gt;
     &lt;s:VerticalLayout/&gt;
 &lt;/s:layout&gt;
 &lt;s:Spacer height="10"/&gt;

 &lt;s:Label text="First Name:"/&gt;
 &lt;s:TextInput width="100%" text="@{data.firstName}"/&gt;
 &lt;s:Label text="Last Name:"/&gt;
 &lt;s:TextInput width="100%" text="@{data.lastName}"/&gt;
&lt;/s:View&gt;</pre>
<p>When you run the application for the first time you won&#8217;t see any information in the two text input boxes. However if you type in something and then close the app and re-open it, you will see the information you typed during the previous session.</p>
<p>When is the <em>data</em> property of a <em>View</em> saved to disk? Every time the application is closed or a <em>View</em> is destroyed/replaced by a new <em>View</em>. In terms of events right after the View deactivate event is triggered.</p>
<p>When is the <em>data</em> property of a <em>View</em> recreated if persistence is turned on? Right before the View activated event is thrown.</p>
<p>The <em>data</em> property of each <em>View</em> is saved to disk using <em>flash.net.SharedObject</em> and the object that does this is the <em>ViewNavigator</em> instance accessible in any <em>View</em> class by using the <em>navigator</em> property.</p>
<p>If you want to be sure that the <em>data</em> property is persisted you can call <em>navigator.saveViewData()</em> in your <em>View</em>. Why would you want to trigger the saving process manually? Because in the unlikely event the app is closed by the operating system due to low battery or memory events you cannot be sure that the normal event flow for closing the app will be followed. By calling <em>navigator.saveViewData()</em> manually each time the user updates something you can make sure that nothing will be lost.</p>
<h2>RegisterClassAlias</h2>
<p>When you serialize ActionScript objects to files or use SharedObject the original data type is lost when you deserialize them. The same applies when using the <em>data</em> property of the <em>View</em> because, under the hood, <em>SharedObject</em> is used for storing the data. If you want to keep the custom data type, all you have to do is to use <em>registerClassAlias()</em> method.</p>
<p>Why? Because the serialization is done using the AMF3 format (Action Message Format) and if you want to preserve the class information for the objects you serialize/deserialize then you have register the class alias of the class object. If you don&#8217;t do this, when you decode the objects you&#8217;ll get anonymous objects.</p>
<p>In a previous section I used a custom data type User. If I want to make sure that the data type is preserved I can register this class in the main application file (this way I make sure that the class is registered before any decoding is performed):</p>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
 xmlns:s="library://ns.adobe.com/flex/spark"
 firstView="views.HomeView" persistNavigatorState="true"&gt;

&lt;fx:Script&gt;
&lt;![CDATA[
   import flash.net.registerClassAlias;

   <strong>registerClassAlias("User", User);</strong>
]]&gt;
&lt;/fx:Script&gt;

&lt;/s:ViewNavigatorApplication&gt;</pre>
<h2>Conclusions</h2>
<p>On Android you have to remember to set the appropriate permission in the application configuration file if you want to write files to disk (android.permission.WRITE_EXTERNAL_STORAGE). Also take into consideration how much space the data you want to saved will occupy. You should let the user know if you plan to consume GB of space.</p>
]]></content:encoded>
			<wfw:commentRss>http://corlan.org/2011/08/18/flex-mobile-development-storing-data-locally/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Flex Mobile Development: caching images using ContentCache</title>
		<link>http://corlan.org/2011/08/16/flex-mobile-development-caching-images-using-contentcache/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flex-mobile-development-caching-images-using-contentcache</link>
		<comments>http://corlan.org/2011/08/16/flex-mobile-development-caching-images-using-contentcache/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 15:05:12 +0000</pubDate>
		<dc:creator>Mihai Corlan</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[PlayBook]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://corlan.org/?p=3106</guid>
		<description><![CDATA[
			
				
			
		
There are many places where you can optimize your code especially when working on mobile applications. In this post I will focus on caching images using the spak.core.ContentCache class (part of the Flex framework).
Right from the Flex documentation, you can see ContentCache could be useful:
Provides a caching and queuing image content loader suitable for using [...]]]></description>
			<content:encoded><![CDATA[<div class="none" style="float: right; margin-left: 10px;"><g:plusone href="http://corlan.org/2011/08/16/flex-mobile-development-caching-images-using-contentcache/" size="tall" count="true"></g:plusone></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F16%2Fflex-mobile-development-caching-images-using-contentcache%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F16%2Fflex-mobile-development-caching-images-using-contentcache%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>There are many places where you can optimize your code especially when working on mobile applications. In this post I will focus on caching images using the <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/core/ContentCache.html"><em>spak.core.ContentCache</em></a> class (part of the Flex framework).</p>
<p>Right from the Flex documentation, you can see <em>ContentCache</em> could be useful:</p>
<blockquote><p>Provides a caching and queuing image content loader suitable for using   a shared image cache for the BitmapImage and spark Image components.</p></blockquote>
<h2>Why cache images?</h2>
<p>So why would you cache images? Every time you set a new source for a Spark <em>Image</em> or a <em>BitmapImage</em> object a new <em>flash.display.Loader</em> object is created to load the image bytes.</p>
<p>Now, let&#8217;s suppose you display a list of items and each item has an image (could be an icon or could be a picture). Each image is hosted on a remote server so it has to be downloaded. Finally, some of these images are the same for different items in the list (for example for a Twitter client it is quite common to see many entries with the same avatar; each entry represents a tweet from the same user and the avatar is the same in this case).</p>
<p>If you don&#8217;t use a caching mechanism, you will notice that as you scroll through the list it will take some time to load images. And the same could happen for images stored locally especially if they are not very small. While waiting for images to load and be displayed the first time is OK (and there isn&#8217;t much to do other than preload them) waiting for the same image every time it is displayed is quite annoying.</p>
<p>Here comes the <em>ContentCache</em> class. This class stores the bytes loaded (actually it stores the <em>LoaderInfo</em> object used for loading each image) and every time an image must be loaded it first checks the cache; if is not there then it goes through the loading process. If it is cached already, then it provides the <em>LoaderInfo</em> object.</p>
<p><span id="more-3106"></span></p>
<h2>How do you use the <em>ContentCache</em> class?</h2>
<p>You can enable caching for your Spark <em>Image</em> or <em>BitmapImage</em> objects quite easy. All you have to do is to create an instance of <em>ContentCache</em> and set this instance to the <em>contentLoader</em> property of the <em>BitmapImage</em> or <em>Image</em> object. Other than this, it&#8217;s business as usual. When you want to load an image you just set the source property of the <em>Image</em> or <em>BitmapImage</em> object and the <em>ContentCache</em> object will take care of the rest.</p>
<p>There is one thing you must be aware of: if an image was changed after it was cached and the source is the same then you have to invalidate the cache yourself in order to see the new image. Otherwise you will see the old version. When you want to remove an image from the cache you use the <em>removeCacheEntry()</em> method and pass the source for the image you want to invalidate in the cache.</p>
<p>You control the number of cached images using <em>maxCacheEntries</em> property (the default value is 100).</p>
<p>Let&#8217;s see a simple example:</p>
<pre>private var cache:ContentCache = new ContentCache();

private function setImage(source:String):void {
   //if we didn't set the cache
   if ( !img.contentLoader ) {
       img.contentLoader = cache;
   }
   //set the image source
   img.source = source;
}
...
&lt;s:Image id="img"/&gt;</pre>
<h2>Using <em>ContentCache</em> with Lists</h2>
<p>The Flex framework has a built-in list item renderer that supports images: <em>IconItemRenderer</em>. This is perfect for displaying lists that have images and text. By default the <em>IconItemRenderer</em> uses a <em>ContentCache</em> object to cache the images. <del>However the <em>ContentCache</em> instance is not shared across all the item renderers.</del></p>
<p>What do I mean? A Flex mobile list uses virtualization. This means that if the list displays 10 items at once it will create about 11 item renderer instances and reuse them. So even if the list has 1,000 items to display only 11 item renderers will be created. Next, each item renderer instance will use a <em>ContentCache</em> instance to cache the images. <del>So in total there will be 11 <em>ContentCache</em> instances. This means that it could happen to have an image already displayed by the list but because it was cached by a different <em>ContentCache</em> instance than the one used by the current item it will be loaded again.</del></p>
<p>The <em>IconItemRenderer</em> class uses a static property to hold an instance of the <em>ContentCache</em>. This means that the same image cache will be used by your list. However, if you have a second list or you use multiple item renderers for the same list, by default, it will be used another instance of <em>ContentCache</em>. The easiest way to fix this is to first create a single <em>ContentCache</em> instance (you can use the Singleton pattern here):</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #9900cc; font-weight: bold;">package</span> org<span style="color: #000066; font-weight: bold;">.</span>corlan<span style="color: #000066; font-weight: bold;">.</span>utils <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> spark<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>ContentCache<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> ImageCache <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> _instance<span style="color: #000066; font-weight: bold;">:</span>ImageCache<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> cache<span style="color: #000066; font-weight: bold;">:</span>ContentCache<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> ImageCache<span style="color: #000000;">&#40;</span>s<span style="color: #000066; font-weight: bold;">:</span>Singleton<span style="color: #000066; font-weight: bold;">,</span> maxCacheEntries<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a>=<span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cache = <span style="color: #0033ff; font-weight: bold;">new</span> ContentCache<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cache<span style="color: #000066; font-weight: bold;">.</span>maxCacheEntries = maxCacheEntries<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> getInstance<span style="color: #000000;">&#40;</span>maxCacheEntries<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a>=<span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span>ImageCache <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>ImageCache<span style="color: #000066; font-weight: bold;">.</span>_instance == <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ImageCache<span style="color: #000066; font-weight: bold;">.</span>_instance = <span style="color: #0033ff; font-weight: bold;">new</span> ImageCache<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> Singleton<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> maxCacheEntries<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> ImageCache<span style="color: #000066; font-weight: bold;">.</span>_instance<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #9900cc; font-weight: bold;">class</span> Singleton <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span></div>
</li>
</ol>
</div>
<p>Then you extend the <em>IconItemRenderer</em> and set this Singleton as the <em>contentLoader</em> object:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> ListItemRenderer <span style="color: #0033ff; font-weight: bold;">extends</span> IconItemRenderer <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> ListItemRenderer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iconContentLoader = ImageCache<span style="color: #000066; font-weight: bold;">.</span>getInstance<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>cache<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div>
</li>
</ol>
</div>
<p>When you build from scratch a list item renderer that uses images, you can use the same approach.</p>
<p>Obviously this technique can be used for other places as well not only for lists.</p>
<h2>Drawbacks</h2>
<p>As with any caching or pooling technique there are trade-offs. You have to find a fine balance between not caching any images and caching all the images. By default the <em>ContentLoader</em> is set to cache 100 entries. But this doesn&#8217;t mean that it is the best value.  It all depends on how big the images are and how much memory you want to use for caching. So be sure you take this into consideration when caching images.</p>
]]></content:encoded>
			<wfw:commentRss>http://corlan.org/2011/08/16/flex-mobile-development-caching-images-using-contentcache/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Flex Mobile Development: Creating Dialog Windows</title>
		<link>http://corlan.org/2011/08/10/flex-mobile-development-creating-dialog-windows/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flex-mobile-development-creating-dialog-windows</link>
		<comments>http://corlan.org/2011/08/10/flex-mobile-development-creating-dialog-windows/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 14:54:42 +0000</pubDate>
		<dc:creator>Mihai Corlan</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[PlayBook]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://corlan.org/?p=3088</guid>
		<description><![CDATA[
			
				
			
		
Ever wondered how to create a modal dialog window in Flex mobile applications? For example, you may want to ask the user for a confirmation when he performs a delete operation or maybe to select an item from a list. Well, if you don&#8217;t know how to do it, then read on.
Flex has a class [...]]]></description>
			<content:encoded><![CDATA[<div class="none" style="float: right; margin-left: 10px;"><g:plusone href="http://corlan.org/2011/08/10/flex-mobile-development-creating-dialog-windows/" size="tall" count="true"></g:plusone></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F10%2Fflex-mobile-development-creating-dialog-windows%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcorlan.org%2F2011%2F08%2F10%2Fflex-mobile-development-creating-dialog-windows%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Ever wondered how to create a modal dialog window in Flex mobile applications? For example, you may want to ask the user for a confirmation when he performs a delete operation or maybe to select an item from a list. Well, if you don&#8217;t know how to do it, then read on.</p>
<p>Flex has a class that just does this: <em><a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/SkinnablePopUpContainer.html">SkinnablePopUpContainer</a></em>. <em>SkinnablePopUpContainer</em> extends <em>SkinnableContainer</em> class and has a very simple API you can use in order to &#8220;open&#8221; and &#8220;close&#8221; the dialog.</p>
<h2>Understanding SkinnablePopUpContainer</h2>
<p>Because <em>SkinnablePopUpContainer</em> extends the <em>SkinnableContainer</em> it is extremely easy to create any kind of dialog window you want. You can create a new MXML component that extends the <em>SkinnablePopUpContainer</em>. Then you set a layout manager that works for you (VerticalLayout, HorizontalLayout). And finally, you add the UI components you need &#8211; labels, buttons, lists, and so on.</p>
<p>Suppose you want to create a simple alert window that looks like this:</p>
<p><img title="Alert Window" src="http://corlan.org/wp-content/uploads/2011/08/dialog1.png" alt="" width="437" height="145" /></p>
<p><span id="more-3088"></span></p>
<p>Here is the code to implement this (as a new MXML component that extends <em>SkinnablePopUpContainer</em>):</p>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;s:SkinnablePopUpContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    backgroundColor="0x898989"&gt;

    &lt;s:layout&gt;
        &lt;s:VerticalLayout horizontalAlign="center"/&gt;
    &lt;/s:layout&gt;

   &lt;s:Label text="The contact was saved" width="100%" textAlign="center"/&gt;
   &lt;s:Button label="OK" width="100%" click="this.close()"/&gt;
&lt;/s:SkinnablePopUpContainer&gt;</pre>
<p>The API for controlling the <em>SkinnablePopUpContainer</em> is pretty simple:</p>
<ul>
<li>To open or display the window you create a new instance and then call the <em>open()</em> method of <em>SkinnablePopUpContainer</em>. This method has two arguments. The first argument is the display object container where it will be created. The second argument is a flag that tells Flex if the window will be modal or not.</li>
<li>To close the window and send data from the window to the application you use the <em>close</em>() method of <em>SkinnablePopUpContainer</em>. This methods also has two arguments. The first argument is a flag. You can set this to true if, for example, the user clicked the OK button, and false otherwise. If you want to send some data back to the application you use the second argument. For example, if you have a <em>TextInput</em> in your dialog and you want to send the text you will use this second argument.</li>
<li>To listen for the close event and read the data sent from the <em>SkinnablePopUpContainer</em> you have to register an event listener on the <em>SkinnablePopUpContainer</em>. The event type is <em>PopUpEvent</em>. <em>PopUpEvent</em> has two properties that you can use to read the flag and data set when calling the <em>close()</em> method: <em>commit</em> and <em>data</em>.</li>
</ul>
<p>Here is an example of how to open a <em>SkinnablePopUpContainer</em> component and read the flag/data when it is closed:</p>
<pre>//create the component and open it
var alertWindow:SkinnablePopUpContainer = new SkinnablePopUpContainer();
alertWindow.addEventListener(PopUpEvent.CLOSE, onAlertClose, false, 0, true);
alertWindow.width = stage.width;
alertWindow.height = stage.height / 2;
alertWindow.x = 0;
alertWindow.y = 100;
alertWindow.open(this, true);

private function onAlertClose(event:PopUpEvent):void {
    trace(event.commit);
    trace(event.data);
    alertWindow = null;
}</pre>
<h2>Creating custom dialog windows</h2>
<p>Once you understand how to use the <em>SkinnablePopUpContainer</em> it is pretty simple to create any kind of dialog window you might need: confirmation messages, simple alerts, pop up lists, and so on. Here is the code for a confirmation window that has two buttons (Yes and No) and lets you set the message text:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>SkinnablePopUpContainer xmlns<span style="color: #000066; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xmlns<span style="color: #000066; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;0&#215;898989&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;400&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>layout<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>VerticalLayout gap=<span style="color: #990000;">&quot;20&quot;</span> paddingBottom=<span style="color: #990000;">&quot;10&quot;</span> paddingLeft=<span style="color: #990000;">&quot;30&quot;</span> paddingRight=<span style="color: #990000;">&quot;30&quot;</span> paddingTop=<span style="color: #990000;">&quot;30&quot;</span> horizontalAlign=<span style="color: #990000;">&quot;center&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>layout<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _message<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> <span style="color: #004993;">message</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> _message<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">message</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _message = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onClick<span style="color: #000000;">&#40;</span>commit<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">close</span><span style="color: #000000;">&#40;</span>commit<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;{message}&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> textAlign=<span style="color: #990000;">&quot;center&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>HGroup <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Yes&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;50%&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;onClick(true)&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;No&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;50%&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;onClick(false)&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>HGroup<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>SkinnablePopUpContainer<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
</ol>
</div>
<p>And here is how this component look on my Android phone:</p>
<p><img title="Confirmation Window" src="http://corlan.org/wp-content/uploads/2011/08/dialog2.png" alt="" width="251" height="400" /></p>
<p>And here is the code for a pop up list that lets you to set the title, the list&#8217;s data provider, the list&#8217;s label field, the list&#8217;s initial selected items, and multiple selections (you can retrieve the selected items by listening for <em>PopupEvent.CLOSE</em> and reading the <em>data</em> attribute).</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>SkinnablePopUpContainer xmlns<span style="color: #000066; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xmlns<span style="color: #000066; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;0&#215;898989&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;400&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>layout<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>VerticalLayout gap=<span style="color: #990000;">&quot;20&quot;</span> paddingBottom=<span style="color: #990000;">&quot;10&quot;</span> paddingLeft=<span style="color: #990000;">&quot;30&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; paddingRight=<span style="color: #990000;">&quot;30&quot;</span> paddingTop=<span style="color: #990000;">&quot;30&quot;</span> horizontalAlign=<span style="color: #990000;">&quot;center&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>layout<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>collections<span style="color: #000066; font-weight: bold;">.</span>ArrayCollection<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _dataProvider<span style="color: #000066; font-weight: bold;">:</span>ArrayCollection<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _labelField<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _allowMultipleSelection<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _selectedItems<span style="color: #000066; font-weight: bold;">:</span>Vector<span style="color: #000066; font-weight: bold;">.&lt;</span>Object<span style="color: #000066; font-weight: bold;">&gt;;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> selectedItems<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span>Vector<span style="color: #000066; font-weight: bold;">.&lt;</span>Object<span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> _selectedItems<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> selectedItems<span style="color: #000000;">&#40;</span>v<span style="color: #000066; font-weight: bold;">:</span>Vector<span style="color: #000066; font-weight: bold;">.&lt;</span>Object<span style="color: #000066; font-weight: bold;">&gt;</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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _selectedItems = v<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> allowMultipleSelection<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> _allowMultipleSelection<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> allowMultipleSelection<span style="color: #000000;">&#40;</span>v<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _allowMultipleSelection = v<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> labelField<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> _labelField<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> labelField<span style="color: #000000;">&#40;</span>v<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _labelField = v<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> dataProvider<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span>ArrayCollection <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> _dataProvider<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> dataProvider<span style="color: #000000;">&#40;</span>v<span style="color: #000066; font-weight: bold;">:</span>ArrayCollection<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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider = v<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onClick<span style="color: #000000;">&#40;</span>commit<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">close</span><span style="color: #000000;">&#40;</span>commit<span style="color: #000066; font-weight: bold;">,</span> list<span style="color: #000066; font-weight: bold;">.</span>selectedItems<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Select an item:&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>List id=<span style="color: #990000;">&quot;list&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataProvider=<span style="color: #990000;">&quot;{dataProvider}&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelField=<span style="color: #990000;">&quot;{labelField}&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; allowMultipleSelection=<span style="color: #990000;">&quot;{allowMultipleSelection}&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selectedItems=<span style="color: #990000;">&quot;{selectedItems}&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>HGroup <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;OK&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;50%&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;onClick(true)&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Cancel&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;50%&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;onClick(false)&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>HGroup<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>SkinnablePopUpContainer<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
</ol>
</div>
<p>And here is the component running on my phone:</p>
<p><img class="alignnone size-full wp-image-3095" title="Popup List Dialog" src="http://corlan.org/wp-content/uploads/2011/08/dialog3.png" alt="" width="250" height="400" /></p>
<h2>Skinning</h2>
<p>The two custom dialog windows I showed you in the previous section use the default look and feel. What about skinning a <em>SkinnablePopUpContainer</em>? There is a Flex class that provides the default skin for a <em>SkinnablePopUpContainer</em>: <em>SkinnablePopUpContainerSkin</em>. By creating a skin that extends this default skin you can change the background of the component quite easily. If you look at the <em>SkinnablePopUpContainerSkin</em> skin you&#8217;ll notice that it has a <em>rect</em> with the id equal to <em>background</em>. This is the starting point to change the default background. You can draw additional stuff on top of this background or replace it alltogether with an FXG or PNG file.</p>
<p>For the rest of the UI components used in a <em>SkinnablePopUpContainer </em>(buttons, text inputs, labels, and so on) you will create additional skins and/or use CSS. Here is a screenshot with the same confirmation window but this time using a custom skin:</p>
<p><a href="http://corlan.org/wp-content/uploads/2011/08/dialog4.png"><img class="alignnone size-full wp-image-3098" title="Skinned Confirmation Window" src="http://corlan.org/wp-content/uploads/2011/08/dialog4.png" alt="" width="251" height="400" /></a></p>
<p>Here is the skin class used to customize the confirmation window presented in the previous section:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Skin xmlns<span style="color: #000066; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> xmlns<span style="color: #000066; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; xmlns<span style="color: #000066; font-weight: bold;">:</span>fb=<span style="color: #990000;">&quot;http://ns.adobe.com/flashbuilder/2009&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">alpha</span><span style="color: #000066; font-weight: bold;">.</span>disabled=<span style="color: #990000;">&quot;0.5&quot;</span> xmlns<span style="color: #000066; font-weight: bold;">:</span>skins=<span style="color: #990000;">&quot;org.corlan.dialog.skins.*&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fx<span style="color: #000066; font-weight: bold;">:</span>Metadata<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3f5fbf;">/** </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* @copy spark.skins.spark.ApplicationSkin#hostComponent</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>HostComponent<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;spark.components.SkinnablePopUpContainer&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fx<span style="color: #000066; font-weight: bold;">:</span>Metadata<span style="color: #000066; font-weight: bold;">&gt;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>states<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;normal&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;disabled&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;closed&quot;</span> stateGroups=<span style="color: #990000;">&quot;closedGroup&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;disabledAndClosed&quot;</span> stateGroups=<span style="color: #990000;">&quot;closedGroup&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>states<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;!&#8211;</span> Transitions <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #004993;">open</span> and <span style="color: #004993;">close</span> <span style="color: #000066; font-weight: bold;">&#8211;&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>transitions<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Transition fromState=<span style="color: #990000;">&quot;closed&quot;</span> toState=<span style="color: #990000;">&quot;normal&quot;</span> autoReverse=<span style="color: #990000;">&quot;true&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Fade duration=<span style="color: #990000;">&quot;150&quot;</span> <span style="color: #004993;">target</span>=<span style="color: #990000;">&quot;{chrome}&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>Transition<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Transition fromState=<span style="color: #990000;">&quot;disabledAndClosed&quot;</span> toState=<span style="color: #990000;">&quot;disabled&quot;</span> autoReverse=<span style="color: #990000;">&quot;true&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Fade duration=<span style="color: #990000;">&quot;150&quot;</span> <span style="color: #004993;">target</span>=<span style="color: #990000;">&quot;{chrome}&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>Transition<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Transition fromState=<span style="color: #990000;">&quot;normal&quot;</span> toState=<span style="color: #990000;">&quot;closed&quot;</span> autoReverse=<span style="color: #990000;">&quot;true&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Fade duration=<span style="color: #990000;">&quot;150&quot;</span> <span style="color: #004993;">target</span>=<span style="color: #990000;">&quot;{chrome}&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>Transition<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Transition fromState=<span style="color: #990000;">&quot;disabled&quot;</span> toState=<span style="color: #990000;">&quot;disabledAndClosed&quot;</span> autoReverse=<span style="color: #990000;">&quot;true&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Fade duration=<span style="color: #990000;">&quot;150&quot;</span> <span style="color: #004993;">target</span>=<span style="color: #990000;">&quot;{chrome}&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>Transition<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>s<span style="color: #000066; font-weight: bold;">:</span>transitions<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;!&#8212;</span> Defines the <span style="color: #004993;">background</span> and <span style="color: #004993;">content</span> group used by <span style="color: #0033ff; font-weight: bold;">this</span> skin<span style="color: #000066; font-weight: bold;">.</span> <span style="color: #000066; font-weight: bold;">&#8211;&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>Group id=<span style="color: #990000;">&quot;chrome&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">visible</span><span style="color: #000066; font-weight: bold;">.</span>closedGroup=<span style="color: #990000;">&quot;false&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;!&#8212;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Defines the appearance of the SkinnablePopUpContainer <span style="color: #9900cc; font-weight: bold;">class</span><span style="color: #990000;">&#8216;s background. </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; In this case a FXG file is used to draw the background.</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#8211;&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;skins:BackGroundAlert id=&quot;background&quot; left=&quot;0&quot; right=&quot;0&quot; top=&quot;0&quot; bottom=&quot;0&quot;/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;"> &nbsp; &nbsp; &nbsp; &nbsp;&lt;!&#8212; @copy spark.components.SkinnableContainer#contentGroup &#8211;&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;"> &nbsp; &nbsp; &nbsp; &nbsp;&lt;s:Group id=&quot;contentGroup&quot; left=&quot;0&quot; right=&quot;0&quot; top=&quot;0&quot; bottom=&quot;0&quot; minWidth=&quot;0&quot; minHeight=&quot;0&quot;&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;s:layout&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;s:BasicLayout/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/s:layout&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;"> &nbsp; &nbsp; &nbsp; &nbsp;&lt;/s:Group&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;"> &nbsp; &nbsp;&lt;/s:Group&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;"> &nbsp; &nbsp;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #990000;">&lt;/s:Skin&gt;</span></div>
</li>
</ol>
</div>
<p>And this is the FXG used by the skin class to draw the background:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span> <span style="color: #000066; font-weight: bold;">?&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;</span>Graphic <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;2.0&quot;</span> xmlns=<span style="color: #990000;">&quot;http://ns.adobe.com/fxg/2008&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; xmlns<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">d</span>=<span style="color: #990000;">&quot;http://ns.adobe.com/fxg/2008/dt&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; xmlns<span style="color: #000066; font-weight: bold;">:</span>flm=<span style="color: #990000;">&quot;http://ns.adobe.com/flame/2008&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; scaleGridLeft=<span style="color: #990000;">&quot;10&quot;</span> scaleGridTop=<span style="color: #990000;">&quot;10&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; scaleGridRight=<span style="color: #990000;">&quot;90&quot;</span> scaleGridBottom=<span style="color: #990000;">&quot;90&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>Rect <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100&quot;</span> radiusX=<span style="color: #990000;">&quot;10&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>LinearGradient <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;190.417&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">scaleX</span>=<span style="color: #990000;">&quot;361.667&quot;</span> <span style="color: #004993;">rotation</span>=<span style="color: #990000;">&quot;90&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#FFFFFF&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0.0424137&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#E1DBCE&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0.0886452&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#CEC3AE&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0.139618&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#C4B89F&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0.208589&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#C2B59B&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0.588957&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#C2B59B&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0.758513&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#C0B399&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0.852955&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#B2A58E&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;0.932468&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#918372&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>GradientEntry ratio=<span style="color: #990000;">&quot;1&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#594A42&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>LinearGradient<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>fill<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>stroke<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>SolidColorStroke weight=<span style="color: #990000;">&quot;3&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>stroke<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;/</span>Rect<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;/</span>Graphic<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
</ol>
</div>
<h2>Download</h2>
<p>You can download a working Flex project that includes all the code used in this article from <a href="https://github.com/mcorlan/AlertExample">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://corlan.org/2011/08/10/flex-mobile-development-creating-dialog-windows/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>About Tablets and Smartphones</title>
		<link>http://corlan.org/2011/07/29/about-tablets-and-smartphones/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=about-tablets-and-smartphones</link>
		<comments>http://corlan.org/2011/07/29/about-tablets-and-smartphones/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 16:36:03 +0000</pubDate>
		<dc:creator>Mihai Corlan</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://corlan.org/?p=3060</guid>
		<description><![CDATA[
			
				
			
		
Lately, it is quite impossible to attend a software conference and not see sessions dedicated to mobile  development. This is the hot topic of the day and rightly so, I believe. However, I have the impression that many people think that tablets and smartphones are almost the same thing. This is something that I [...]]]></description>
			<content:encoded><![CDATA[<div class="none" style="float: right; margin-left: 10px;"><g:plusone href="http://corlan.org/2011/07/29/about-tablets-and-smartphones/" size="tall" count="true"></g:plusone></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fcorlan.org%2F2011%2F07%2F29%2Fabout-tablets-and-smartphones%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcorlan.org%2F2011%2F07%2F29%2Fabout-tablets-and-smartphones%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Lately, it is quite impossible to attend a software conference and not see sessions dedicated to mobile  development. This is the hot topic of the day and rightly so, I believe. However, I have the impression that many people think that tablets and smartphones are almost the same thing. This is something that I do not believe is true. Furthermore, I think that because of this belief held by others many tablet applications end up being just a scaled up version of smartphone apps. If a tablet is just a phone with a bigger screen then a tablet app is just a bigger resolution smartphone app, right?</p>
<p>Let&#8217;s see why do I think that a tablet it is not just a bigger phone.</p>
<h2>Tablets are more powerful than smartphones</h2>
<p>This seems to be just a truism. Well, it is and yet most applications that run on tablets and smartphones tend to offer the same set of features and experience.</p>
<p>This is  suboptimal because on a tablet you have more storage space, a more powerful processor, and a bigger screen. And, if the battery doesn&#8217;t last for a full day it is not a tragedy. Is not like you end up in the middle of nowhere with a dead phone :)</p>
<p>All these differences should be exploited to create tablet applications that help people to do more than what they are able to do on a smartphone. If you take into account only the bigger screen you have something that enables people to read for hours without getting teary eyed. When more storage space is available , for example, why not let the user decide how many GB your application can use and offer him a true offline experience for things like email, news, RSS feeds, videos, and so on.</p>
<h2>Tablets are shared smartphones are personal</h2>
<p>Correct me if I&#8217;m wrong, but I have the feeling that, at least in the case of home users, a tablet is shared. This is not the case with your smartphone. You don&#8217;t say &#8220;hey mate, here is my phone. Just return it  in four hours.&#8221;</p>
<p>And if this is true, why are so many tablets apps built with a single user in mind? How can you have a tablet shared when you have to logout from your social or email accounts in order to let the other user do something?</p>
<p>Again, this feels to me like a big opportunity that it is missed. Why not enable multiusers for them and support on all the apps for which it makes sense? Remember, you do have plenty of storage space&#8230;</p>
<h2>The Missed Opportunity</h2>
<p>I think that this tablet shortsightedness is part of the reason for what we are seeing today: there a far fewer apps for tablets than for phones. And this is true for all the application stores.</p>
<p>I think that developers have a real opportunity here, and that for now it is just being missed. Once we fully understand that tablets and smartphones are different and people want and should use them differently, we will see much more innovation.</p>
]]></content:encoded>
			<wfw:commentRss>http://corlan.org/2011/07/29/about-tablets-and-smartphones/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using Adobe AIR to reach multiple devices: Conqu</title>
		<link>http://corlan.org/2011/07/18/using-adobe-air-to-reach-multiple-devices-conqu/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-adobe-air-to-reach-multiple-devices-conqu</link>
		<comments>http://corlan.org/2011/07/18/using-adobe-air-to-reach-multiple-devices-conqu/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 07:58:17 +0000</pubDate>
		<dc:creator>Mihai Corlan</dc:creator>
				<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://corlan.org/?p=3038</guid>
		<description><![CDATA[
			
				
			
		
About three or four months ago I wrote a blogpost about Conqu &#8211; an AIR application for managing tasks. Since then, Conqu has been one of the best demos I have at hand when talking about mobile development with the Flash Platform. Most people couldn&#8217;t believe that Conqu was built using Adobe AIR and Flex.
Back [...]]]></description>
			<content:encoded><![CDATA[<div class="none" style="float: right; margin-left: 10px;"><g:plusone href="http://corlan.org/2011/07/18/using-adobe-air-to-reach-multiple-devices-conqu/" size="tall" count="true"></g:plusone></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fcorlan.org%2F2011%2F07%2F18%2Fusing-adobe-air-to-reach-multiple-devices-conqu%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcorlan.org%2F2011%2F07%2F18%2Fusing-adobe-air-to-reach-multiple-devices-conqu%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>About three or four months ago I wrote a <a href="http://corlan.org/2011/03/25/conqu-one-of-the-coolest-android-apps-outhere/">blogpost</a> about <a href="http://conqu.com/">Conqu</a> &#8211; an AIR application for managing tasks. Since then, Conqu has been one of the best demos I have at hand when talking about mobile development with the Flash Platform. Most people couldn&#8217;t believe that Conqu was built using Adobe AIR and Flex.</p>
<p>Back then, it was available only for Android tablets. But today, Conqu is available in:</p>
<ol>
<li><a href="https://market.android.com/details?id=air.com.conqu">Android Market</a></li>
<li><a href="http://itunes.apple.com/us/app/conqu/id440591468?mt=8">iTunes App Store</a></li>
<li><a href="http://appworld.blackberry.com/webstore/content/31138?lang=en">BlackBerry App World</a></li>
<li><a href="http://www.amazon.com/AsFusion-Conqu/dp/B004XNQ50O/">Amazon Appstore for Android</a></li>
<li><a href="http://search.barnesandnoble.com/Conqu/AsFusion/e/2940043353788?itm=19&amp;USRI=">Nook Color</a></li>
</ol>
<p>Running on an iPad:</p>
<p><img class="alignnone size-full wp-image-3040" title="conqu1" src="http://corlan.org/wp-content/uploads/2011/07/conqu1.png" alt="" width="481" height="359" /></p>
<p>Running on an Android Tablet:</p>
<p><img class="alignnone size-full wp-image-3041" title="conqu2" src="http://corlan.org/wp-content/uploads/2011/07/conqu2.png" alt="" width="481" height="270" /></p>
<p>Conqu is running today on three different OSes: Android (including Nook Color), BlackBerry Tablet OS, and iOS. And this is not all. They are working on making it available on Android phones, iPod Touch/iPhone, and desktop computers.</p>
<p>I tried the app myself on Samsung Galaxy Tab, iPad 2, and PlayBook. On each device it worked just great and looked beautiful at the same time.</p>
<p>I think that, with all modesty, this is a proof that the Flash Platform does deliver on multiple devices and OSes. Because the Conqu team used Adobe AIR and Flex, and applied the same tools and workflows for each version it was much easier to distribute their app across so many devices.</p>
<p>If you want to learn about mobile development with the Flash Platform make sure you show up at one of the events that the evangelism team is participating in all over the world. And of course take a look at the <a href="http://www.adobe.com/devnet/devices.html">Adobe Developer Center</a> page.</p>
<p>Nahuel Foronda of the Conqu team was kind enough to answer some questions I had. So here is a short interview with the team behind Conqu:</p>
<blockquote><p><strong>Me</strong>: <em>What is Conqu?</em><br />
<strong>Nahuel Foronda</strong>: Conqu is an easy to use yet powerful task management tool designed to help you conquer your inbox and get things done. With Conqu, you can organize the tasks by criteria that makes sense to you and then find the right task to do at the right time and place. Whether you are a GTD pro or you just need a simple to-do list, Conqu will provide you with all the tools you need.</p>
<p><strong>Me</strong>: <em>What is your business model for this app because you offer the application for free?</em><br />
<strong>Nahuel Foronda</strong>: Conqu is free because we want to reach as much as people as we can. By removing the monetary barrier we believe that more people will try it out. From those that try it, some will use it once in a while but others will use it daily. People that find value on it are our real customers. They are the ones that appreciate other features like cloud synchronization between devices or the ability to interact with other APIs. Our business model is based on the synchronization service, which is a monthly subscription.</p>
<p><strong>Me</strong>: <em>Did you use the Flex framework or pure ActionScript?</em><br />
<strong>Nahuel Foronda</strong>: We used the Flex Framework. It was a simple decision for us because we were already working with Flex in all of our previous projects. We really wanted to use a CSS system powerful enough to make the look and feel of our app as close to our Photoshop mockups as possible. Flex gives us that flexibility and it also has the advantage of being a great layout framework.</p>
<p><strong>Me</strong>: <em>Conqu doesn&#8217;t look like a Flex app. How did you do it?</em><br />
<strong>Nahuel Foronda</strong>: We used Flex as the foundation but we created a lot of custom components. We used the List, TextInput, TextArea, Flex layouts and containers but the rest is all custom. All of the components (including those included in the framework) are highly skinned with ActionScript skins and graphics. The look and feel was very important for us, so that’s why you don’t find out-of-box Flex skins or regular Flex components in our app.</p>
<p><strong>Me</strong>: <em>The app not only looks great but performs greatly on all devices I tested. How did you do it?</em><br />
<strong>Nahuel Foronda</strong>: The key for us was to use a very lightweight class as base for our components: SpriteVisualElement. That allowed our components to be very responsive. All the Flex layouts work great with this class, so we are able to include our lightweight components in any view. For the animations, we created our own layouts and use the Tweener library.<br />
Another important optimization we did was to make all our skins in ActionScript as opposed to use MXML. In 95% of the cases we used bitmap graphics for things like backgrounds or icons instead of vectors to avoid runtime calculations.</p>
<p><strong>Me</strong>: <em>Your first supported device was Android tablet. How hard was to deliver the app for PlayBook?</em><br />
<strong>Nahuel Foronda</strong>: It was not that bad, but it could have been great if we didn’t have to monkey-patch the Flex Framework to make the app that was running in AIR 2.6 run on the Playbook, which supported only AIR 2.5. I want to clarify that right now it is simple because both run the same version (2.7). At that moment, however, it took me some time to make it work. That&#8217;s what happens when you are working with a device that is not even out yet and is under development :)</p>
<p><strong>Me</strong>: <em>What about the iPad version?</em><br />
<strong>Nahuel Foronda</strong>: That was perfect, very easy to make it work. We only had a couple things here and there but overall, it worked amazingly.</p>
<p><strong>Me</strong>:<em> Did you think about going native for Conqu? What made you change your mind?</em><br />
<strong>Nahuel Foronda</strong>: Not really. We thought at some point about making an iOS-only version, but never three different versions. I don’t like the idea of developing an app three times for three different markets. We don&#8217;t really have the resources to do that. We also don&#8217;t have the time to develop and maintain three different platforms.</p>
<p>AIR allows you to focus on one code base with maybe a few differences in the layout, but still one code. What made me believe it was possible was the schedule app developed for MAX last year. That app was working very well on the small devices and because tablets would have more memory and CPU, if you built something for them, it would run even better. Now, a year later, the phones are faster too, so I believe we made a good choice.</p>
<p><strong>Me</strong>: <em>I know you have in the works versions for phones, Android and iPhone. How did you solve the problem of multiple resolutions/screen densities?</em><br />
<strong>Nahuel Foronda</strong>: I’m working with the CSS queries that the Flex Framework provides. They give us the ability to use different bitmaps for the different resolutions and it is working very well for us because it keeps our code clean. Only the CSS has a reference to all the different resolutions.</p>
<p><strong>Me</strong>: <em>What about the team who build the app? I mean what experience did they have with the Flash Platform and mobile development and how large is the team?</em><br />
<strong>Nahuel Foronda</strong>: We are three people on the team: a designer (Mark) that created all the mocks in Photoshop, a server side developer and Flex developer (Laura), and myself. Laura has great experience in ColdFusion and she takes care of all that plus half the Flex side (using Mate Framework). For example, she is in charge of all the model and most of the business logic in Flex. I’m complementing the team doing the optimization and all the ActionScript code such as custom component and skin development</p>
<p><strong>Me</strong>: <em>Do you have any other killer app in your pipeline?</em><br />
<strong>Nahuel Foronda</strong>: We have a lot of ideas! But we are trying to focus on this one until we have released the desktop and phone versions.</p>
<p><strong>Me</strong>: <em>Is there anything you want to add?</em><br />
<strong>Nahuel Foronda</strong>: Thank you so much for the interview and if your readers want to know more about the whole development process I have a very detailed post that I did not long ago.<br />
<a href="http://www.asfusion.com/blog/entry/design-first-and-the-process-behind">http://www.asfusion.com/blog/entry/design-first-and-the-process-behind</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://corlan.org/2011/07/18/using-adobe-air-to-reach-multiple-devices-conqu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Flex Mobile Lists Part II &#8211; Using Virtualization</title>
		<link>http://corlan.org/2011/07/11/creating-flex-mobile-lists-part-ii-using-virtualization/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-flex-mobile-lists-part-ii-using-virtualization</link>
		<comments>http://corlan.org/2011/07/11/creating-flex-mobile-lists-part-ii-using-virtualization/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 07:53:12 +0000</pubDate>
		<dc:creator>Mihai Corlan</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://corlan.org/?p=2987</guid>
		<description><![CDATA[
			
				
			
		
This is the second part (and the final one for that matter) of my post about creating Flex mobile lists (you can read the first part here). In this post I will show you how I modified the custom layout manager that I created in the first post to add support for virtualization. Also I [...]]]></description>
			<content:encoded><![CDATA[<div class="none" style="float: right; margin-left: 10px;"><g:plusone href="http://corlan.org/2011/07/11/creating-flex-mobile-lists-part-ii-using-virtualization/" size="tall" count="true"></g:plusone></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fcorlan.org%2F2011%2F07%2F11%2Fcreating-flex-mobile-lists-part-ii-using-virtualization%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcorlan.org%2F2011%2F07%2F11%2Fcreating-flex-mobile-lists-part-ii-using-virtualization%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>This is the second part (and the final one for that matter) of my post about creating Flex mobile lists (you can read the first part <a href="http://corlan.org/2011/07/04/creating-flex-mobile-section-lists/">here</a>). In this post I will show you how I modified the custom layout manager that I created in the first post to add support for virtualization. Also I will discuss the theory behind Flex list virtualization and creating custom item renderers.</p>
<p>As a reminder, in the first part I talked about you how you can create a custom list and layout manager that can be used for displaying vertical and tile section lists:</p>
<p><img class="alignnone size-full wp-image-2991" title="list1" src="http://corlan.org/wp-content/uploads/2011/07/list1.png" alt="" width="200" height="289" /> <img class="alignnone size-full wp-image-2992" title="list2" src="http://corlan.org/wp-content/uploads/2011/07/list2.png" alt="" width="200" height="288" /></p>
<p>In this post I will show you how you can create layout managers that support virtualization and custom item renderers. You can see the two custom item renderers below:</p>
<p><img class="alignnone size-full wp-image-2993" title="list3" src="http://corlan.org/wp-content/uploads/2011/07/list3.png" alt="" width="138" height="200" /> <img class="alignnone size-full wp-image-2994" title="list4" src="http://corlan.org/wp-content/uploads/2011/07/list4.png" alt="" width="426" height="200" /></p>
<p>I won&#8217;t discuss how I created the custom list component to support sections. For this read the<a href="http://corlan.org/2011/07/04/creating-flex-mobile-section-lists/"> first part</a> of this series.</p>
<p><span id="more-2987"></span></p>
<h2>Layout Manager with and without Virtualization Support</h2>
<p>So what does virtualization mean in the context of Flex lists and why is virtualization important? Suppose you have 100 items in a list and at any given time you can see no more than 20 items (to see the rest of the items, you have to scroll the list up or down ). If the layout manager used by the list doesn&#8217;t support virtualization then all the 100 items are rendered. The next image illustrates the concept.</p>
<p><img class="alignnone size-full wp-image-2996" title="vl-1" src="http://corlan.org/wp-content/uploads/2011/07/vl-1.png" alt="" width="414" height="384" /></p>
<p>A list that uses a layout manager that supports virtual layout renders only a limited number of items (typically equal with the number of items that fit in the list&#8217;s view port). When the list is scrolled, the item renderers used by the items that were moved out of the view port are recycled to render the items that just entered the view port. The next image illustrates the concept:</p>
<p><img class="alignnone size-full wp-image-2998" title="vl-2" src="http://corlan.org/wp-content/uploads/2011/07/vl-2.png" alt="" width="416" height="384" /></p>
<p>As I explained in the first part, if you have relatively few items (tens) you&#8217;ll get excellent performance using a layout manager without support for virtualization. However, in the next screencast I will show you what happens when you have 1,000 items in your list and you don&#8217;t use virtualization (all 1,000 items are created at once).</p>
<p><iframe src="http://player.vimeo.com/video/26159439" frameborder="0" height="250" width="400"></iframe></p>
<p>In the next video, you can see the same list and 1,000 items but this time using virtualization. As you can see, the list is created almost instantly as opposed to taking 5 or 6 seconds as in the previous video.</p>
<p><iframe src="http://player.vimeo.com/video/26159473" frameborder="0" height="250" width="400"></iframe></p>
<h2>Creating a Custom Layout Manager</h2>
<p>Let&#8217;s see how I created the layout manager you&#8217;ve seen in the previous videos. When you want to create a layout manager you have to override/implement at least two methods: <em>measure()</em> and <em>updateDisplayList()</em>.</p>
<h3>Using Virtualization</h3>
<p>Now, let&#8217;s discuss what it is happening in terms of methods that are executed when you have a layout manager that uses virtualization.</p>
<p>First, your list component is instantiated and when the list&#8217;s <em>DataGroup.validateSize()</em> method is called the layout manager&#8217;s <em>measure()</em> methods gets called. The <em>validateSize()</em> method is executed at least once (when the list is created) and this represents the second pass of the layout (the first one is <em>DataGroup.commitProperties()</em>).</p>
<p>Next, as the <em>DataGroup.validateDisplayList()</em> method is executed (every time the list display list is invalidated) it will call the layout manager <em>updateDisplayList()</em> method.</p>
<p>So what to do you do inside of these two methods (<em>measure()</em> and <em>updateDisplayList()</em>)?</p>
<h4>measure()</h4>
<p>You use the <em>measure()</em> method to calculate the total height/width of the list&#8217;s DataGroup and set these values back to the DataGroup. Remember that all the items that can&#8217;t be fit in the view port are clipped. To see them you have to scroll through the list. Well,  in order to get the scrolling to work correctly (this means that the size of the thumb is proportional to the number of items and you can scroll up to the first item and down to the last one) you have to calculate the total size occupied by all the elements as if all of them would be rendered. The catch is to do so without instantiating any item renderers.</p>
<p>My custom layout manager has properties for section title height, regular item height, and width. So these values are set by the programmer. This means, that I used these properties in the measure() method. You also need the data items. Remember that my list uses two different ways to render the data depending on type (section title or not). You can access the list data provider like this:</p>
<p>var dataProvider:IList = (target as DataGroup).dataProvider;</p>
<p>So, in my layout I loop through all of these items and calculate the total height (for a layout manager like Vertical Layout with items that have the same size, you wouldn&#8217;t need to loop through all the items; for example, you can multiply the height of one item by the total number of items in order to calculate the total height).</p>
<p>If you want to use the current size of the view port you can read the <em>target.width</em> and <em>target.height</em> properties. Take care when doing this because depending on the life cycle state of your list these values can be zero sometimes.</p>
<p>Once you calculated the total height and width you can set them to the DataGroup by calling:</p>
<p>target.setContentSize(totalWidth, totalHeight);</p>
<p>Here is the complete code for the <em>measure()</em> method (please note that the method is executed only when <em>useVirtualLayout</em> is set to true; otherwise I exit at the top of the method body):</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> measure<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> &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>useVirtualLayout<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> layoutTarget<span style="color: #000066; font-weight: bold;">:</span>GroupBase = <span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>layoutTarget<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> dataGroupTarget<span style="color: #000066; font-weight: bold;">:</span>DataGroup = layoutTarget <span style="color: #0033ff; font-weight: bold;">as</span> DataGroup<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>dataGroupTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span> == <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000066; font-weight: bold;">||</span> dataGroupTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> == <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _containerWidth = _containerHeight = <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> totalWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> totalHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> dataProvider<span style="color: #000066; font-weight: bold;">:</span>IList = dataGroupTarget<span style="color: #000066; font-weight: bold;">.</span>dataProvider<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>dataProvider <span style="color: #000066; font-weight: bold;">||</span> <span style="color: #000066; font-weight: bold;">!</span>dataProvider<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> count<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = dataProvider<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> rowWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = dataGroupTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> sectionHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = _sectionHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> tileHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = _tileHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> tileWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = _columnWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; totalWidth = rowWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> elementWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> elementHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; yToIndex = <span style="color: #0033ff; font-weight: bold;">new</span> Vector<span style="color: #000066; font-weight: bold;">.&lt;</span>int<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; indexToY = <span style="color: #0033ff; font-weight: bold;">new</span> Vector<span style="color: #000066; font-weight: bold;">.&lt;</span>int<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">d</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a> = <span style="color: #004993;">d</span> = dataProvider<span style="color: #000066; font-weight: bold;">.</span>getItemAt<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_sectionLabel <span style="color: #0033ff; font-weight: bold;">in</span> <span style="color: #004993;">d</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addToVectorY<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> sectionHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; totalHeight = sectionHeight <span style="color: #000066; font-weight: bold;">+</span> _verticalGap<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addToVectorY<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> tileHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; totalHeight = tileHeight <span style="color: #000066; font-weight: bold;">+</span> _verticalGap<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//loop though all the elements elements</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &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><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = <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> count<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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">d</span> = dataProvider<span style="color: #000066; font-weight: bold;">.</span>getItemAt<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span><span style="color: #004993;">d</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementWidth = tileWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementHeight = tileHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_sectionLabel <span style="color: #0033ff; font-weight: bold;">in</span> <span style="color: #004993;">d</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementWidth = rowWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementHeight = sectionHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementWidth = tileWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementHeight = tileHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Would this element fit on this line, or should we move it</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// to the next line?</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span> elementWidth <span style="color: #000066; font-weight: bold;">&gt;</span> rowWidth<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//add the index to vector</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addToVectorY<span style="color: #000000;">&#40;</span>i<span style="color: #000066; font-weight: bold;">,</span> totalHeight <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> elementHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; totalHeight <span style="color: #000066; font-weight: bold;">+</span>= elementHeight <span style="color: #000066; font-weight: bold;">+</span> _verticalGap<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addToVectorIndex<span style="color: #000000;">&#40;</span>i<span style="color: #000066; font-weight: bold;">,</span> totalHeight <span style="color: #000066; font-weight: bold;">-</span> elementHeight <span style="color: #000066; font-weight: bold;">-</span> _verticalGap<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Update the current position, add the gap</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span>= elementWidth <span style="color: #000066; font-weight: bold;">+</span> _horizontalGap<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; layoutTarget<span style="color: #000066; font-weight: bold;">.</span>measuredWidth = totalWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; layoutTarget<span style="color: #000066; font-weight: bold;">.</span>measuredHeight = totalHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; layoutTarget<span style="color: #000066; font-weight: bold;">.</span>measuredMinWidth = totalWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; layoutTarget<span style="color: #000066; font-weight: bold;">.</span>measuredMinHeight = totalHeight<span style="color: #000066; font-weight: bold;">;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; layoutTarget<span style="color: #000066; font-weight: bold;">.</span>setContentSize<span style="color: #000000;">&#40;</span>totalWidth<span style="color: #000066; font-weight: bold;">,</span> totalHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div>
</li>
</ol>
</div>
<h4>updateDisplayList()</h4>
<p>When the layout manager uses virtualization, the <em>updateDisplayList()</em> is called everytime you scroll through the list. Actually, when you scroll, first the <em>scrollPositionChanged()</em> method is called and if inside this method the target.<em>invalidateDisplayList()</em> method is called, then the <em>updateDisplayList()</em> method will be called. I will talk about the <em>scrollPositionChanged()</em> method in the next section.</p>
<p>The <em>updateDisplayList</em>() is called with two arguments: the width and height of the <em>DataGroup</em> view port. Inside of this method you will position and resize the items you want to display. Because we are talking about a virtual layout, you will not resize and position each element of the list. Ideally you will work only on those that are in the current view.</p>
<p>As you can imagine, the difficulty is in determining what elements must be displayed. The way I solved this is pretty simple. In the <em>measure()</em> method, when I loop through all the items, I save the correspondence between an item and its <em>y</em> value and between a <em>y</em> value and a data provider index (where the <em>y</em> value moves from 0 to the total height of the <em>DataGroup</em> content area).</p>
<p>How do you position and resize an item? You can use the <em>ILayoutElement</em> interface (the layout manager target property has a method named <em>getVirtualElementAt()</em> that you can use to retrieve one item):</p>
<p>// get the current element, we&#8217;re going to work with the<br />
// ILayoutElement interface<br />
element = target.getVirtualElementAt(i);</p>
<p>//resize the element<br />
element.setLayoutBoundsSize(elementWidth, elementHeight);<br />
// Position the element<br />
element.setLayoutBoundsPosition(x, y);</p>
<p>Here is the complete code for <em>updateDisplayList()</em> when <em>useVirtualLayout</em> is set to true:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> updateDisplayList<span style="color: #000000;">&#40;</span>containerWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> containerHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>useVirtualLayout<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updateVirtual<span style="color: #000000;">&#40;</span>containerWidth<span style="color: #000066; font-weight: bold;">,</span> containerHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updateNonVirtual<span style="color: #000000;">&#40;</span>containerWidth<span style="color: #000066; font-weight: bold;">,</span> containerHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">/**</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp;* Lay down the current items in the view &#8211; this is used when useVirtualLayout is set to true</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp;*/</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> updateVirtual<span style="color: #000000;">&#40;</span>containerWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> containerHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> layoutTarget<span style="color: #000066; font-weight: bold;">:</span>GroupBase = <span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span><span style="color: #000000;">&#40;</span>layoutTarget <span style="color: #0033ff; font-weight: bold;">as</span> DataGroup<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>dataProvider <span style="color: #000066; font-weight: bold;">||</span> <span style="color: #000000;">&#40;</span>layoutTarget <span style="color: #0033ff; font-weight: bold;">as</span> DataGroup<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>dataProvider<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> == <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>_containerWidth<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _containerWidth = containerWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>_containerHeight<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _containerHeight = containerHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//a resize of the component occured</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_containerWidth <span style="color: #000066; font-weight: bold;">!</span>= containerWidth <span style="color: #000066; font-weight: bold;">||</span> _containerHeight <span style="color: #000066; font-weight: bold;">!</span>= containerHeight<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _containerWidth = containerWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _containerHeight = containerHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addExtraItems = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; measure<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//set the new _firstIndex and _lastIndex</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scrollPositionChanged<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>layoutTarget<span style="color: #000066; font-weight: bold;">.</span>numElements<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> maxWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> maxHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> elementWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> elementHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> prevElementHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//provide the initial values</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>_firstIndexInView<span style="color: #000000;">&#41;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _firstIndexInView = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>_lastIndexInView<span style="color: #000000;">&#41;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _lastIndexInView = yToIndex<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000066; font-weight: bold;">&gt;</span> layoutTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">?</span> yToIndex<span style="color: #000000;">&#91;</span>layoutTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span> &nbsp;<span style="color: #000066; font-weight: bold;">:</span> layoutTarget<span style="color: #000066; font-weight: bold;">.</span>numElements <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//add some extra rows after the current view</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; currentFirstIndex = _firstIndexInView<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>currentFirstIndex <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentFirstIndex = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>addExtraItems<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addExtraItems = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ceil</span><span style="color: #000000;">&#40;</span>containerWidth <span style="color: #009966; font-style: italic;">/ (_columnWidth + _horizontalGap)) * Math.ceil(containerHeight /</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>_tileHeight <span style="color: #000066; font-weight: bold;">+</span> _sectionHeight<span style="color: #000000;">&#41;</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: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; currentLastIndex = _firstIndexInView <span style="color: #000066; font-weight: bold;">+</span> addExtraItems<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>currentLastIndex <span style="color: #000066; font-weight: bold;">&gt;</span> layoutTarget<span style="color: #000066; font-weight: bold;">.</span>numElements <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentLastIndex = layoutTarget<span style="color: #000066; font-weight: bold;">.</span>numElements <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">y</span> = indexToY<span style="color: #000000;">&#91;</span>currentFirstIndex<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> count<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = currentLastIndex <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> element<span style="color: #000066; font-weight: bold;">:</span>ILayoutElement<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &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><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = currentFirstIndex<span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> count<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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// get the current element, we&#8217;re going to work with the</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// ILayoutElement interface</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element = layoutTarget<span style="color: #000066; font-weight: bold;">.</span>getVirtualElementAt<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Resize the element to its preferred size by passing</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// NaN for the width and height constraints</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element<span style="color: #000066; font-weight: bold;">.</span>setLayoutBoundsSize<span style="color: #000000;">&#40;</span><span style="color: #004993;">NaN</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">NaN</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>element<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;data&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> _sectionLabel <span style="color: #0033ff; font-weight: bold;">in</span> element<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;data&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementWidth = containerWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementHeight = _sectionHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementWidth = _columnWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementHeight = _tileHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element<span style="color: #000066; font-weight: bold;">.</span>setLayoutBoundsSize<span style="color: #000000;">&#40;</span>elementWidth<span style="color: #000066; font-weight: bold;">,</span> elementHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Would the element fit on this line, or should we move</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// to the next line?</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span> elementWidth <span style="color: #000066; font-weight: bold;">&gt;</span> containerWidth<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//move to the next row</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">+</span>= prevElementHeight <span style="color: #000066; font-weight: bold;">+</span> _verticalGap<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Position the element</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element<span style="color: #000066; font-weight: bold;">.</span>setLayoutBoundsPosition<span style="color: #000000;">&#40;</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prevElementHeight = elementHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Update the current position, add the gap</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span>= elementWidth <span style="color: #000066; font-weight: bold;">+</span> _horizontalGap<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div>
</li>
</ol>
</div>
<h4>scrollPositionChanged()</h4>
<p>The final piece of the puzzle is the <em>scrollPositionChanged()</em> method<em>.</em> As I already said, this method is called every time the list is scrolled. You can find the current view port&#8217;s x and y properties by using the <em>getScrollRect()</em>. This method returns a <em>Rectangle</em> instance. Then you can read the <em>top</em> and <em>bottom</em> properties of the <em>Rectangle</em> instance to find where the <em>DataGroup</em> content is scrolled. For example:</p>
<p>var r:Rectangle = getScollRect();<br />
var yTop:Number = r.top;<br />
var yBottom:Number = r.bottom;</p>
<p>Then, using the values I saved when the <em>measure()</em> method was executed I can find the index of the the first item to be displayed and the index of the first item on the last visible row. I save these indexes and if they are outside of the indexes I rendered during the previous call to <em>updateDisplayList()</em> I invalidate the <em>DataGroup</em> display list, which in turn will call the layout manager <em>updateDisplayList()</em> method (and here I will use the two indexes I calculated in the <em>scrollPositionChanged()</em> method).</p>
<p>Please note that you can play around with these two indexes. For example you can add another row before the first visible row and one after the last visible row if you want to optimize small and unintended scroll actions (for example, you won&#8217;t execute the <em>updateDisplayList()</em> method if the list was scrolled 10 or 20 pixels).</p>
<p>Here is the complete code of <em>scrollPositionChanged()</em> (notice that it is executed only when <em>useVirtualLayout</em> is set to true; otherwise I just call the parent <em>scrollPositionChanged()</em>):</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> scrollPositionChanged<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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>useVirtualLayout<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span>scrollPositionChanged<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> g<span style="color: #000066; font-weight: bold;">:</span>GroupBase = <span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>g<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span> &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; updateScrollRect<span style="color: #000000;">&#40;</span>g<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">width</span><span style="color: #000066; font-weight: bold;">,</span> g<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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> n<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = g<span style="color: #000066; font-weight: bold;">.</span>numElements <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>n <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setIndexInView<span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> scrollR<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=rectangle%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:rectangle.html"><span style="color: #004993;">Rectangle</span></a> = getScrollRect<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>scrollR<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setIndexInView<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> n<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span> &nbsp; &nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> y0<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = scrollR<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">top</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> y1<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = scrollR<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">bottom</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000066; font-weight: bold;">.</span>0001<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>y1 <span style="color: #000066; font-weight: bold;">&lt;</span>= y0<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setIndexInView<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> n<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> i0<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000066; font-weight: bold;">,</span> i1<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>y0 <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i0 = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i1 = yToIndex<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000066; font-weight: bold;">&gt;</span> g<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">?</span> yToIndex<span style="color: #000000;">&#91;</span>g<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span> &nbsp;<span style="color: #000066; font-weight: bold;">:</span> g<span style="color: #000066; font-weight: bold;">.</span>numElements <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setIndexInView<span style="color: #000000;">&#40;</span>i0<span style="color: #000066; font-weight: bold;">,</span> i1<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>y1 <span style="color: #000066; font-weight: bold;">&lt;</span> yToIndex<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i0 = yToIndex<span style="color: #000000;">&#91;</span><a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span>y0<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i1 = yToIndex<span style="color: #000000;">&#91;</span><a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html"><span style="color: #004993;">Math</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ceil</span><span style="color: #000000;">&#40;</span>y1<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>yToIndex<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000066; font-weight: bold;">-</span> g<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span> <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i0 = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i0 = yToIndex<span style="color: #000000;">&#91;</span>yToIndex<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000066; font-weight: bold;">-</span> g<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i1 = yToIndex<span style="color: #000000;">&#91;</span>yToIndex<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; setIndexInView<span style="color: #000000;">&#40;</span>i0<span style="color: #000066; font-weight: bold;">,</span> i1<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//invalidate display list only if we have items that are not already renderered</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>i0 <span style="color: #000066; font-weight: bold;">&lt;</span> currentFirstIndex <span style="color: #000066; font-weight: bold;">||</span> i1 <span style="color: #000066; font-weight: bold;">&gt;</span> currentLastIndex<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; g<span style="color: #000066; font-weight: bold;">.</span>invalidateDisplayList<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div>
</li>
</ol>
</div>
<p>For the complete code of this layout manager please check the <strong>Download the code</strong> section of this post.</p>
<h3>Without Virtualization</h3>
<p>I enabled the same layout manager to work as one without virtualization support. As I said, there are situations when you prefer such a layout.</p>
<h4>measure()</h4>
<p>When the layout manager works without virtualization support, the <em>measure()</em> method does nothing (you have to implement it though if you extended BaseLayout; failing to do so will trigger a runtime error).</p>
<h4>updateDisplayList()</h4>
<p>This is where the heavy lifting will happen. This method will loop through all the items and position and resize each one. This method is executed only once as long as the <em>DataGroup</em> display list is not invalidated (you don&#8217;t change the list size or data provider for example).</p>
<p>Also, you have to set the <em>DataGroup</em> content size in order to enable scrolling on the list:</p>
<p>// Scrolling support &#8211; update the content size<br />
target.setContentSize(width, height);</p>
<p>Here is the code:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> updateNonVirtual<span style="color: #000000;">&#40;</span>containerWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> containerHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> layoutTarget<span style="color: #000066; font-weight: bold;">:</span>GroupBase = <span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span><span style="color: #000000;">&#40;</span>layoutTarget <span style="color: #0033ff; font-weight: bold;">as</span> DataGroup<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>dataProvider <span style="color: #000066; font-weight: bold;">||</span> <span style="color: #000000;">&#40;</span>layoutTarget <span style="color: #0033ff; font-weight: bold;">as</span> DataGroup<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>dataProvider<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> == <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>_containerWidth<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _containerWidth = containerWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>_containerHeight<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _containerHeight = containerHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> maxWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> maxHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> elementWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> elementHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> prevElementHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//add some extra rows after the current view</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> count<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = layoutTarget<span style="color: #000066; font-weight: bold;">.</span>numElements<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> element<span style="color: #000066; font-weight: bold;">:</span>ILayoutElement<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &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><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = <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> count<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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// get the current element, we&#8217;re going to work with the</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// ILayoutElement interface</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element = layoutTarget<span style="color: #000066; font-weight: bold;">.</span>getElementAt<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Resize the element to its preferred size by passing</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// NaN for the width and height constraints</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element<span style="color: #000066; font-weight: bold;">.</span>setLayoutBoundsSize<span style="color: #000000;">&#40;</span><span style="color: #004993;">NaN</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">NaN</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>element<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;data&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> _sectionLabel <span style="color: #0033ff; font-weight: bold;">in</span> element<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;data&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementWidth = containerWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementHeight = _sectionHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementWidth = _columnWidth<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elementHeight = _tileHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element<span style="color: #000066; font-weight: bold;">.</span>setLayoutBoundsSize<span style="color: #000000;">&#40;</span>elementWidth<span style="color: #000066; font-weight: bold;">,</span> elementHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Would the element fit on this line, or should we move</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// to the next line?</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span> elementWidth <span style="color: #000066; font-weight: bold;">&gt;</span> containerWidth<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//move to the next row</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">+</span>= prevElementHeight <span style="color: #000066; font-weight: bold;">+</span> _verticalGap<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Position the element</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element<span style="color: #000066; font-weight: bold;">.</span>setLayoutBoundsPosition<span style="color: #000000;">&#40;</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prevElementHeight = elementHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Update the current position, add the gap</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span>= elementWidth <span style="color: #000066; font-weight: bold;">+</span> _horizontalGap<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Scrolling support &#8211; update the content size</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; layoutTarget<span style="color: #000066; font-weight: bold;">.</span>setContentSize<span style="color: #000000;">&#40;</span>containerWidth<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div>
</li>
</ol>
</div>
<h4>scrollPositionChanged()</h4>
<p>Again nothing to do here. You just call the <em>super.scrollPositionChanged()</em> method.</p>
<h2>Creating Custom List Item Renderers</h2>
<p>It is important to create item renderers that are extremely efficient. Otherwise all the work you put in creating and optimizing the custom layout manager will be for naught. For mobile development there are two built-in item renderers, both implemented using ActionScript. As a rule of thumb you don&#8217;t want to use MXML for graphics to create item renderers. Instead use FXG, bitmaps, and ActionScript.</p>
<p>The item renderers I created are designed to work with lists with or without sections. As I explained in the first part of this series, depending on the type of a data item (it either has a section property or it doesn&#8217;t) it is rendered differently.</p>
<p>Here are the methods you will most likely touch when developing custom item renderers:</p>
<ol>
<li><em>set data()</em>. I override this method so I can check if the data to be set is a section title or not. Depending on this, I change the font styles and the value of the label property.</li>
<li><em>createChildren()</em>. This method is called automatically when an item renderer is instantiated. And this is where you create the parts you need. In the case of one of the item renderers I created, I only had to create an <em>Image</em> and a Sprite (the label part is created in the class I extend, <em>LabelItemRenderer</em>).</li>
<li><em>updateDisplayList()</em>. This method is called automatically when the item renderer is added to the <em>DataGroup</em> display list or the<em> invalidateDisplayList()</em> method is called. Inside of this method you can size and position the various parts. This method executes the following methods (in this order): <em>drawBackground()</em> and <em>layoutContents()</em>. If you draw on the background of the component using its graphics object then you have to call <em>graphics.clear()</em> before redrawing anything.</li>
<li><em>drawBackground()</em>. This method renders the background for the item renderer. For example this is where the different color for marking an item selection is drawn.</li>
<li><em>layoutContent()</em>. This method is used to position the children. You can use setElementPosition(child, x, y) or setElementSize(child, width, height).</li>
</ol>
<p>For the project I worked on, I needed two different item renderers for the same list. Both item renderers must support two different appearance: one for a section title and one for a regular item. The first item renderer I created extends the built-in <em>IconItemRenderer</em>. I had to extend it in order to support the section titles. Here is the code:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">/**</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp;* &nbsp;Section Title font size</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp;*/</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;sectionFontSize&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;Number&quot;</span><span style="color: #000066; font-weight: bold;">,</span> format=<span style="color: #990000;">&quot;Length&quot;</span><span style="color: #000066; font-weight: bold;">,</span> inherit=<span style="color: #990000;">&quot;no&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> ListItemRenderer <span style="color: #0033ff; font-weight: bold;">extends</span> IconItemRenderer <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _backgroundSection<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = 0xDDDDDD<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> sectionFontSize<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;sectionFontSize&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">value</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> backgroundSection<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _backgroundSection = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _sectionLabel<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;section&quot;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> sectionLabel<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span> == _sectionLabel<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _sectionLabel = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; invalidateProperties<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _normalLabelField<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;label&quot;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> normalLabelField<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _normalLabelField = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3f5fbf;">/**</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Change the style based on the data: section item or regular item</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">data</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000000;">&#91;</span>_sectionLabel<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label = <span style="color: #004993;">value</span><span style="color: #000000;">&#91;</span>_sectionLabel<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;textAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;center&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fontWeight&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;bold&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fontSize&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;sectionFontSize&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iconWidth = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iconWidth = iconHeight<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label = <span style="color: #004993;">value</span><span style="color: #000000;">&#91;</span>_normalLabelField<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fontSize&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fontSize&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;textAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;left&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fontWeight&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;normal&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span> = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span> &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3f5fbf;">/**</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Change the background color for section items</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> drawBackground<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span>drawBackground<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000000;">&#91;</span>_sectionLabel<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>_backgroundSection<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineStyle</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> unscaledWidth<span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div>
</li>
</ol>
</div>
<p>The second item renderer is just a simple &#8220;tile&#8221; for regular items. It displays an icon on top of the item and at the bottom, a label. I chose to extend the built-in <em>LabelItemRenderer </em>and add an <em>Image</em> and draw couple of things on top of the existing ones. Here is the source code:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">/**</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp;* &nbsp;Section Title font size</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp;*/</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;sectionFontSize&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;Number&quot;</span><span style="color: #000066; font-weight: bold;">,</span> format=<span style="color: #990000;">&quot;Length&quot;</span><span style="color: #000066; font-weight: bold;">,</span> inherit=<span style="color: #990000;">&quot;no&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> TileItemRenderer <span style="color: #0033ff; font-weight: bold;">extends</span> LabelItemRenderer <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> _imageCache<span style="color: #000066; font-weight: bold;">:</span>ContentCache<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> TileItemRenderer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_imageCache == <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _imageCache = <span style="color: #0033ff; font-weight: bold;">new</span> ContentCache<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _imageCache<span style="color: #000066; font-weight: bold;">.</span>enableCaching = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _imageCache<span style="color: #000066; font-weight: bold;">.</span>maxCacheEntries = <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _backgroundSection<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = 0xDDDDDD<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> backgroundSection<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _backgroundSection = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> sectionFontSize<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;sectionFontSize&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">value</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">fontSize</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fontSize&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">value</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _backgroundRegular<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = 0xF4DD06<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _backgroundLabel<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = 0xEAEAE8<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _normalLabelField<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;label&quot;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> normalLabelField<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _normalLabelField = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _sectionLabel<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;section&quot;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> sectionLabel<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span> == _sectionLabel<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _sectionLabel = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; invalidateProperties<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _iconField<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3f5fbf;">/**</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;The name of the field in the data item to display as the icon. </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;By default &lt;code&gt;iconField&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;, and the item renderer </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;does not display an icon.</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;@default null</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;@langversion 3.0</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;@playerversion AIR 2.5</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;@productversion Flex 4.5</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> iconField<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> _iconField<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3f5fbf;">/**</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;@private</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> iconField<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span> == _iconField<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _iconField = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; invalidateProperties<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3f5fbf;">/**</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Change the style based on the data: section item or regular item</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">data</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000000;">&#91;</span>_sectionLabel<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>image<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>labelBg<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelBg<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label = <span style="color: #004993;">value</span><span style="color: #000000;">&#91;</span>_sectionLabel<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;textAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;center&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fontWeight&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;bold&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fontSize&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;sectionFontSize&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_iconField <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> <span style="color: #004993;">value</span><span style="color: #000000;">&#91;</span>_iconField<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>image<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">source</span> = <span style="color: #004993;">value</span><span style="color: #000000;">&#91;</span>_iconField<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>image<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">source</span> = <span style="color: #990000;">&quot;&quot;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>labelBg<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelBg<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label = <span style="color: #004993;">value</span><span style="color: #000000;">&#91;</span>_normalLabelField<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fontSize&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fontSize&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;textAlign&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;left&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;fontWeight&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;normal&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span> = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span> &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//destroyIconDisplay() todo;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> updateDisplayList<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// clear the graphics before calling super.updateDisplayList()</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span>updateDisplayList<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//the following methods are called in super.updateDisplayList();</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//drawBackground(unscaledWidth, unscaledHeight);</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//layoutContents(unscaledWidth, unscaledHeight);</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> image<span style="color: #000066; font-weight: bold;">:</span>Image<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> labelBg<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> drawn<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html"><span style="color: #004993;">Boolean</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> createChildren<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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>image<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image = <span style="color: #0033ff; font-weight: bold;">new</span> Image<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image<span style="color: #000066; font-weight: bold;">.</span>smooth = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">scaleMode</span> = BitmapScaleMode<span style="color: #000066; font-weight: bold;">.</span>STRETCH<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image<span style="color: #000066; font-weight: bold;">.</span>fillMode = BitmapFillMode<span style="color: #000066; font-weight: bold;">.</span>SCALE<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image<span style="color: #000066; font-weight: bold;">.</span>contentLoader = _imageCache<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>image<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//create the background for label</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>labelBg<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelBg = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html"><span style="color: #004993;">Sprite</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>labelBg<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span>createChildren<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3f5fbf;">/**</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Change the background color for section items</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> drawBackground<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span>drawBackground<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span><span style="color: #000000;">&#91;</span>_sectionLabel<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>_backgroundSection<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineStyle</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> unscaledWidth<span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//add a vertical line to the right of the item&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> rightSeparatorColor<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = 0&#215;000000<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> rightSeparatorAlpha<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #000066; font-weight: bold;">.</span>3<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>rightSeparatorColor<span style="color: #000066; font-weight: bold;">,</span> rightSeparatorAlpha<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span>unscaledWidth <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//draw a rounded corner place holder for text and icon</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//let a padding around for seeing through the selection</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>_backgroundRegular<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineStyle</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawRoundRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">3</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> unscaledWidth <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">6</span><span style="color: #000066; font-weight: bold;">,</span> unscaledHeight <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">6</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: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> layoutContents<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span>layoutContents<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000066; font-weight: bold;">,</span> unscaledHeight<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//position the image</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span><span style="color: #004993;">data</span><span style="color: #000000;">&#91;</span>_sectionLabel<span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> _iconField <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> <span style="color: #004993;">data</span><span style="color: #000000;">&#91;</span>_iconField<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setElementPosition<span style="color: #000000;">&#40;</span>image<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: #000000; font-weight:bold;">5</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setElementSize<span style="color: #000000;">&#40;</span>image<span style="color: #000066; font-weight: bold;">,</span> unscaledWidth <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> unscaledWidth <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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span><span style="color: #004993;">data</span><span style="color: #000000;">&#91;</span>_sectionLabel<span style="color: #000000;">&#93;</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> labelDisplay<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelDisplay<span style="color: #000066; font-weight: bold;">.</span>commitStyles<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> h<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = labelDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">height</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//draw for holding the text</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>drawn<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; drawn = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelBg<span style="color: #000066; font-weight: bold;">.</span><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelBg<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span>_backgroundLabel<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelBg<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineStyle</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelBg<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">drawRoundRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">3</span><span style="color: #000066; font-weight: bold;">,</span> unscaledHeight <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> h<span style="color: #000066; font-weight: bold;">,</span> unscaledWidth <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">6</span><span style="color: #000066; font-weight: bold;">,</span> h <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">6</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: #000000; font-weight:bold;">10</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; labelBg<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setElementPosition(labelBg, 0, unscaledHeight &#8211; 10 &#8211; h);</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> paddingLeft<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;paddingLeft&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//reposition the label at the bottom of the item</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setElementPosition<span style="color: #000000;">&#40;</span>labelDisplay<span style="color: #000066; font-weight: bold;">,</span> paddingLeft<span style="color: #000066; font-weight: bold;">,</span> unscaledHeight <span style="color: #000066; font-weight: bold;">-</span> h<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div>
</li>
</ol>
</div>
<p>You can watch this screencast to see these item renderers in action together with the custom layout manager and list:</p>
<p><iframe src="http://player.vimeo.com/video/26159490" frameborder="0" height="250" width="400"></iframe></p>
<p>And here is the same code running on my Nexus One:</p>
<p><iframe src="http://player.vimeo.com/video/26259161" frameborder="0" height="250" width="400"></iframe></p>
<h2>Conclusions</h2>
<p>I hope that I managed to shed some light on the dark art of creating custom lists/layout managers/item renderers. If you need to create something like this, I encourage you to take a look at how the built-in layout managers and item renderers were implemented. You will learn a lot. Also, especially when creating mobile applications try to use/extend the built-in Flex classes. The Flex SDK team put a lot of effort into optimizing this code. So you will get all the future improvements for &#8220;free&#8221;.</p>
<p>If you have created custom lists maybe you can drop a comment and share with us your work.</p>
<h2>Download the Code</h2>
<p>You can download all the code used in this series from my GitHub <a href="https://github.com/mcorlan/SectionLists">account</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://corlan.org/2011/07/11/creating-flex-mobile-lists-part-ii-using-virtualization/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Creating Flex Mobile Section Lists</title>
		<link>http://corlan.org/2011/07/04/creating-flex-mobile-section-lists/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-flex-mobile-section-lists</link>
		<comments>http://corlan.org/2011/07/04/creating-flex-mobile-section-lists/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 01:30:50 +0000</pubDate>
		<dc:creator>Mihai Corlan</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://corlan.org/?p=2931</guid>
		<description><![CDATA[
			
				
			
		
For a mobile application I&#8217;m working on I need a section list. If you are familiar with the Flex framework you know that you don&#8217;t have built-in section list components (you can have vertical, horizontal, and tile lists). I played a little bit with the Flex List, IconItemRenderer, and BasicLayout classes and managed to put [...]]]></description>
			<content:encoded><![CDATA[<div class="none" style="float: right; margin-left: 10px;"><g:plusone href="http://corlan.org/2011/07/04/creating-flex-mobile-section-lists/" size="tall" count="true"></g:plusone></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fcorlan.org%2F2011%2F07%2F04%2Fcreating-flex-mobile-section-lists%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fcorlan.org%2F2011%2F07%2F04%2Fcreating-flex-mobile-section-lists%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>For a mobile application I&#8217;m working on I need a section list. If you are familiar with the Flex framework you know that you don&#8217;t have built-in section list components (you can have vertical, horizontal, and tile lists). I played a little bit with the Flex List, IconItemRenderer, and BasicLayout classes and managed to put together two section lists: a vertical section list and a tile section list. In this post I will talk about how I did it and about some theory behind the list components.</p>
<p><span id="more-2931"></span></p>
<h2>What is a Section List?</h2>
<p>Before talking about code, let&#8217;s establish what a section list is:</p>
<ul>
<li>It is a list that provides a way to render items grouped in sections. For example, if you have a data structure like &#8220;Fruits, Banana, Cherry, Kiwi, Cheese, Cheddar, Gorgonzola&#8221; a section list will render this data in a way that makes it clear that Fruits/Banana/Cherry/Kiwi is one section and Cheese/Cheddar/Gorgonzola is another one;</li>
<li>The section title items can&#8217;t be selectable. In our example, clicking on Fruits or Cheese items will not throw a select event nor will it select the item;</li>
<li>Section title items should be rendered so that it is clear they are different from regular items.</li>
</ul>
<p>Here is an example of a vertical section list (blue items are section title items, the gray Blueberries item represents the current selection):</p>
<p><img class="aligncenter size-full wp-image-2941" title="section-list" src="http://corlan.org/wp-content/uploads/2011/06/section-list.png" alt="" width="300" height="434" /></p>
<p>If you wonder why you&#8217;d need such a list, here are a couple of examples where you can find it pretty useful:</p>
<ul>
<li>You have a list of people and you want to display the items sorting alphabetically. By creating sections A, B, C, and so on users can easily navigate through the sections to find what they are looking for;</li>
<li>You have a properties or preference page in your application with a bunch of options (for example, Editing, Account, and so forth). You can nicely organize the information so users can find their way quickly.</li>
</ul>
<h2>Some Theory Behind Flex lists</h2>
<p>This is the boring section of this post :) If you don&#8217;t like it, feel free to skip it :D</p>
<p>Flex mobile lists inherit the architecture of the Spark components introduced in Flex 4 back in 2010. An oversimplified dissection of a Flex mobile list would reveal these &#8220;organs&#8221;: list component, DataGroup, Scroller, layout manager, and item renderer. By default a Flex mobile list is a vertical list (items are rendered vertically and if there are more than can be fitted on the view port than you can scroll the list up and down).</p>
<p>Here is a description of how these things work together:</p>
<ul>
<li>The list component uses a container for holding the items that will be displayed. This container is an instance of the <em>DataGroup</em> class.</li>
<li>The <em>DataGroup</em> container implements the <em>IViewport</em> interface. If the items to be displayed don&#8217;t fit in the viewport, they are clipped.</li>
<li>To scroll the viewport of the <em>DataGroup</em> and see the rest of the items, a <em>Scroller</em> is used. In the case of the mobile Flex list the <em>Scroller</em> displays a scrollbar only when you interact with the list (by default it is hidden). Its size gives a visual clue about the number of the elements from the list (the more elements in the list, the smaller the thumb).</li>
<li>The list component uses a layout manager. This class is in control of how and where the items displayed in the <em>DataGroup</em> are rendered.</li>
<li>Each item of the list is displayed using an item renderer. The Flex framework gives you two built-in item renderers for lists: <em>IconItemRenderer</em> and <em>LabelRenderer</em>. The item renderer class is in charge of how an item will be rendered on the screen. Lists are designed to work with a single item renderer.</li>
<li>The list component has a property called <em>dataProvider</em> that you can use to set the data you want to display. Typically you&#8217;d assign to this property and <em>Array</em> or an <em>ArrayCollection</em> of <em>Strings</em> or <em>Objects</em>.</li>
<li>Finally, mobile lists use virtualization (the virtualization part is implemented actually by the layout manager). This means that only the items that are visible in the viewport are rendered. And when the viewport is moved (for example, you scroll the list down) the item renderers of the items that were moved out of the view port are reused for the items that just got in the view port. This way, even on a mobile device, you can have lists with 10,000 items and you want run out of memory. However there is still a cost with this approach: the <em>DataGroup</em> has to execute a bunch of <em>removeChildAt()</em> and <em>addChildAt()</em> calls in order to reuse the item renderer instances.</li>
</ul>
<p>I won&#8217;t get into details about how everything is linked together at runtime and what methods are called and when. I&#8217;ll save this for another post.</p>
<p>The first section list I wanted to create was a vertical section list. Let&#8217;s see how I implement it.</p>
<h2>Creating a Vertical Section List</h2>
<p>I looked at the built-in Flex mobile list and I realized that making a Vertical Section List would be quite easy. The VerticalLayout manager does all the work I needed, and the only things I had to change were:</p>
<ol>
<li>Disabling item selection for list items that are section titles;</li>
<li>Finding a simple way to define the data provider structure (which data items are section title items and which are just regular items).</li>
<li>Extend one of the two built-in item renderers so I can have two  distinct looks: one for section title items and one for regular items;</li>
</ol>
<p>First, I decided on how to model the data provider used for the <em>SectionList</em>. I decided that I want to be able to use an <em>Array</em> or <em>ArrayCollection</em> of objects and I will use different properties to store the label for section title items and regular items.</p>
<p>Next, I created a new class that extends the Flex List class. In this class I override the <em>item_mouseDownHandler()</em> method. This method is executed each time you touch the list. So all I had to do is to check whether the item touched is a section title item or not. If it is, then I just call <em>event.preventDefault()</em> to cancel the selection.</p>
<p>Next, I added a property named <em>sectionField</em> to store the property name used for defining a data as an section list. Here is the code of the <em>SectionList</em> class:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #9900cc; font-weight: bold;">package</span> org<span style="color: #000066; font-weight: bold;">.</span>corlan<span style="color: #000066; font-weight: bold;">.</span>components <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &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><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> spark<span style="color: #000066; font-weight: bold;">.</span>components<span style="color: #000066; font-weight: bold;">.</span>IItemRenderer<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> spark<span style="color: #000066; font-weight: bold;">.</span>components<span style="color: #000066; font-weight: bold;">.</span>List<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> SectionList <span style="color: #0033ff; font-weight: bold;">extends</span> List <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3f5fbf;">/**</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* The property name for data that are section title items</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _sectionField<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> sectionField<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _sectionField = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3f5fbf;">/**</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Disable selection for section title items </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3f5fbf;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> item_mouseDownHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">currentTarget</span> <span style="color: #0033ff; font-weight: bold;">is</span> IItemRenderer<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">data</span> = IItemRenderer<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">currentTarget</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span> <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> <span style="color: #004993;">data</span><span style="color: #000000;">&#91;</span>_sectionField<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">preventDefault</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000066; font-weight: bold;">.</span>item_mouseDownHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000;">&#125;</span></div>
</li>
</ol>
</div>
<p>Then I created a new item renderer by extending the built-in mobile item renderer <em>IconItemRenderer</em>. <em>IconItemRenderer</em> enables you to display more than just a label (you can have a decorator, an image, and a subtitle). To tell you the truth, I have used only the label. So, I guess I could have chosen the <em>LabelRenderer</em> as well.</p>
<p>The first thing I did was to override the <em>set data()</em> method. This method is called automatically everytime the item renderer class is used to render a data item. So this is the perfect place to check if the data that is about to be displayed is a section title item or not. Depending on the result I change the font alignment and weight and I change the <em>labelField</em> value to the property name to be used as the source of the text.</p>
<p>Next, I override the <em>drawBackground()</em> method. This method draws the background of the item. Depending on what data I have to render I change the color of the background.</p>
<p>Finally, I added three new properties that allow me to set the name of the property that holds a section title item, a regular item, and background color to be used for section title items: <em>sectionField</em> and <em>normalLabelField</em>.</p>
<p>Here is the code of the custom item renderer:</p>
<div class='sniplrcode'>
<ol class="actionscript3" style="font-family:monospace;">
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000066; font-weight: bold;">&lt;</span>s<span style="color: #000066; font-weight: bold;">:</span>IconItemRenderer xmlns<span style="color: #000066; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xmlns<span style="color: #000066; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> &nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> iconWidth=<span style="color: #990000;">&quot;64&quot;</span> iconHeight=<span style="color: #990000;">&quot;64&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;</span>fx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _backgroundSection<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a> = 0xDDDDDD<span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> backgroundSection<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><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></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _backgroundSection = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _normalLabelField<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;label&quot;</span><span style="color: #000066; font-weight: bold;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> normalLabelField<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> <span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">return</span> _normalLabelField<span style="color: #000066; font-weight: bol
