<?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>SmartLogic Solutions Blog &#187; Flex</title>
	<atom:link href="http://blog.smartlogicsolutions.com/tag/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smartlogicsolutions.com</link>
	<description>News and updates from the people at SmartLogic Solutions</description>
	<lastBuildDate>Tue, 30 Nov 2010 21:39:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Introducing PureMVCGen &#8211; an ANT based PureMVC Flex Generator</title>
		<link>http://blog.smartlogicsolutions.com/2008/12/05/introducing-puremvcgen-an-ant-based-puremvc-flex-generator/</link>
		<comments>http://blog.smartlogicsolutions.com/2008/12/05/introducing-puremvcgen-an-ant-based-puremvc-flex-generator/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 21:47:04 +0000</pubDate>
		<dc:creator>Greg Jastrab</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Greg Jastrab]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ANT]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[PureMVC]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=409</guid>
		<description><![CDATA[I just published a PureMVC code generation tool I&#8217;ve been working on lately. It&#8217;s an ANT-based tool, but is distributed via Ruby Gems, which allows it to be easily installed as a command-line tool once you have Ruby, rubygems, and ANT installed. Once you have those programs installed, simply enter ($> just denotes you are [...]]]></description>
			<content:encoded><![CDATA[<p>I just published a <a href="http://www.puremvc.org">PureMVC</a> code generation tool I&#8217;ve been working on lately.  It&#8217;s an ANT-based tool, but is distributed via <a href="http://rubygems.org">Ruby Gems</a>, which allows it to be easily installed as a command-line tool once you have <a href="http://www.ruby-lang.org">Ruby</a>, rubygems, and <a href="http://ant.apache.org">ANT</a> installed.</p>
<p>Once you have those programs installed, simply enter (<code>$></code> just denotes you are at a prompt on the command line)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$<span style="color: #000000; font-weight: bold;">&gt;</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> puremvc-gen</pre></div></div>

<p>and the tool will be installed.  Read on to see how to use it&#8230;</p>
<p><span id="more-409"></span></p>
<h4>Project Settings</h4>
<p>Presently, there is one bit of configuration housekeeping that must be done to get started using the tool.  Within the source directory of your project you will need to add a <b>proj.properties</b> file containing 5 property settings:</p>
<ul>
<li><b>app.prefix</b> =&gt; what to prefix your Facade and application Mediator with</li>
<li><b>project.name</b> =&gt; the name of your main MXML file </li>
<li><b>core.namespace</b> =&gt; the namespace of the project</li>
<li><b>core.dir</b> =&gt; the directory corresponding to the namespace (this will eventually be inferred from <b>core.namespace</b>)</li>
<li><b>pmvc.flavor</b> =&gt; <code>standard</code> | <code>multicore</code> (although only standard is currently supported)</li>
</ul>
<p>An example configuration for a project called <b>MyDemo</b> using the namespace <code>com.mydemo.demo</code> would look like:</p>
<h5>Example proj.properties</h5>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">app.prefix = Demo
project.name = MyDemo
core.namespace = com.mydemo.demo
core.dir = com/mydemo/demo
pmvc.flavor = standard</pre></div></div>

<h4>Using PureMVCGen</h4>
<h5>Validating Project Properties</h5>
<p>If you are starting a new PureMVC project and you have the <b>proj.properties</b> file created in the source directory:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$<span style="color: #000000; font-weight: bold;">&gt;</span> puremvc-gen check</pre></div></div>

<p>will ensure that the properties are correctly set.  If they have been, at the end of the ANT output, you should see:<br />
<div id="attachment_418" class="wp-caption alignnone" style="width: 428px"><img src="http://blog.smartlogicsolutions.com/wp-content/uploads/2008/12/validated.png" alt="Display showing properties have been validated" title="Properties Validated" width="418" height="71" class="size-full wp-image-418" /><p class="wp-caption-text">Display showing properties have been validated</p></div></p>
<h5>Generating the PureMVC Skeleton</h5>
<p>To generate the PureMVC directories, main MXML file, Facade, main Mediator, StartupCommand, and PrepareActorsCommand classes, simply enter:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$<span style="color: #000000; font-weight: bold;">&gt;</span> puremvc-gen init</pre></div></div>

<p>After this was run successfully the directory hierarchy will look something like this:<br />
<div id="attachment_421" class="wp-caption aligncenter" style="width: 284px"><img src="http://blog.smartlogicsolutions.com/wp-content/uploads/2008/12/skeleton.png" alt="PureMVC skeleton generated from demo project properties" title="Generated PureMVC Skeleton" width="274" height="250" class="size-full wp-image-421" /><p class="wp-caption-text">PureMVC skeleton generated from demo project properties</p></div></p>
<h5>Other Commands</h5>
<p>I haven&#8217;t created any online documentation yet, but the tool has fairly decent instructions on the command line.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$<span style="color: #000000; font-weight: bold;">&gt;</span> puremvc-gen <span style="color: #7a0874; font-weight: bold;">help</span></pre></div></div>

<p><a href="http://blog.smartlogicsolutions.com/wp-content/uploads/2008/12/instructions.png"><img src="http://blog.smartlogicsolutions.com/wp-content/uploads/2008/12/instructions.png" alt="Instructions output on command line when running \&quot;help\&quot;" title="PureMVCGen Instructions" width="500" height="127" class="size-full wp-image-423" /></a><br />
A quick rundown of the command, proxy, and mediator generation commands:</p>
<ul>
<li><b>puremvc-gen new command</b> =&gt; generates a simple command</li>
<li><b>puremvc-gen new command -m</b> (or &#8211;macro) =&gt; generates a macro command</li>
<li><b>puremvc-gen new mediator</b> =&gt; generates a mediator</li>
<li><b>puremvc-gen new proxy</b> =&gt; generates a proxy</li>
</ul>
<p>All of these generation commands may be passed a <code>-n</code> option to specify the name for the class on the command line.  Otherwise, ANT will prompt you to input the name.</p>
<h4>Where to Git It</h4>
<p>The project is <a href="http://github.com/gjastrab/puremvc-gen/tree/master">hosted at github</a> so feel free to checkout the source.  I&#8217;ll update the README file eventually so that front page will have documentation as well.</p>
<p>The gem is also <a href="http://rubyforge.org/projects/gjastrab/">hosted at RubyForge</a> so you can download it there if you&#8217;d like to build it manually.</p>
<p>The GitHub page will eventually include a Roadmap for planned features, but please comment here with any suggestions you may have.</p>
<p>Finally, if you&#8217;re averse to Ruby you can always download the <b>conf/</b> directory of the project, and manually run the ANT commands.  They are a bit more cryptic though, which is why the gem and executable it provides are nice, however it should output instructions on what settings need to be made to run it manually.</p>
<p>Enjoy!</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2008/12/18/puremvcgen-011-released-now-works-on-windows/" rel="bookmark" class="crp_title">PureMVCGen 0.1.1 Released &#8211; Now Works on Windows</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/15/compiling-your-first-flex-4-application/" rel="bookmark" class="crp_title">Compiling Your First Flex 4 Application</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/11/12/watch-multiple-logs-in-a-single-terminal/" rel="bookmark" class="crp_title">Watch Multiple Logs in a Single Terminal</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/08/21/getting-subclipse-to-work-in-gandymede-eclipse-34/" rel="bookmark" class="crp_title">Getting Subclipse to Work in Gandymede (Eclipse 3.4)</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/10/14/facebox-with-prototype/" rel="bookmark" class="crp_title">Facebox With Prototype</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2008/12/05/introducing-puremvcgen-an-ant-based-puremvc-flex-generator/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Displaying an Image in a ComboBox</title>
		<link>http://blog.smartlogicsolutions.com/2008/12/01/displaying-an-image-in-a-combobox/</link>
		<comments>http://blog.smartlogicsolutions.com/2008/12/01/displaying-an-image-in-a-combobox/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 16:17:53 +0000</pubDate>
		<dc:creator>Greg Jastrab</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Greg Jastrab]]></category>
		<category><![CDATA[ComboBox]]></category>
		<category><![CDATA[Image]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=392</guid>
		<description><![CDATA[I needed to display an Image inside of a ComboBox for a recent project. The image of a selectedItem needed to appear in the ComboBox when it is collapsed and the image needed to be specified as a String. I was surprised that a quick search didn&#8217;t find any components to allow this. The closest [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to display an Image inside of a ComboBox for a recent project.  The image of a selectedItem needed to appear in the ComboBox when it is collapsed and the image needed to be specified as a String.</p>
<p>I was surprised that a quick search didn&#8217;t find any components to allow this.  The closest was a <a href="http://flexibleexperiments.wordpress.com/2007/04/28/flex-201-combobox-with-icon-support/">post by Jason Hawryluk</a>, however this required the image to be embedded into the application.</p>
<p>So I simply extended ComboBox to include an Image within it, and added some sizing calculations so it would respect padding.  An example follows below:<br />
<span id="more-392"></span></p>
<p>[flash http://blog.smartlogicsolutions.com/wp-content/uploads/2008/11/ImageComboBox.swf H=150]</p>
<p>The <a href="http://blog.smartlogicsolutions.com/wp-content/uploads/2008/11/ImageComboBox.as">ImageComboBox class</a> </p>
<ol>
<li>Adds an Image in the <code>createChildren</code> method</li>
<li>Measures the available size the image can take up in the <code>measure</code> method</li>
<li>In the <code>updateDisplayList</code> method, if an item is selected:</li>
<ol>
<li>Sets the source for the Image</li>
<li>Places and sizes the Image based on calculations from <code>measure</code></li>
</ol>
</ol>
<p>In order to prevent the ComboBox from displaying &#8220;[object Object]&#8221; along with the image, be sure to include a label=&#8221;" property on the items in the <code>dataProvider</code> for the ComboBox.  The following code is the MXML main file for the embedded SWF above:</p>
<h4>Example MXML</h4>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">	            xmlns:sls=<span style="color: #ff0000;">&quot;com.slslabs.flex.controls.*&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> text=<span style="color: #ff0000;">&quot;This demonstrates using the ImageComboBox&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;sls:ImageComboBox</span> width=<span style="color: #ff0000;">&quot;60&quot;</span> paddingLeft=<span style="color: #ff0000;">&quot;5&quot;</span> paddingTop=<span style="color: #ff0000;">&quot;5&quot;</span> paddingBottom=<span style="color: #ff0000;">&quot;5&quot;</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;sls:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> url=<span style="color: #ff0000;">&quot;http://www.iconarchive.com/icons/iconshock/mario-bros/mario-32x32.png&quot;</span> label=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> url=<span style="color: #ff0000;">&quot;http://www.iconarchive.com/icons/iconshock/mario-bros/luigui-32x32.png&quot;</span> label=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> url=<span style="color: #ff0000;">&quot;http://www.iconarchive.com/icons/iconshock/mario-bros/start-32x32.png&quot;</span> label=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;/sls:dataProvider</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;sls:itemRenderer</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Component</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Image</span> source=<span style="color: #ff0000;">&quot;{data.url}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Component</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;/sls:itemRenderer</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/sls:ImageComboBox</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>I pushed the code into my first git repository <a href="http://github.com/gjastrab/imagecombobox/tree/master">at github</a>.  If you&#8217;re a git n00b, then after you&#8217;ve <a href="http://www.google.com/search?hl=en&#038;q=install+git&#038;btnG=Google+Search&#038;aq=f&#038;oq=">installed git</a> (or checked out the <a href="http://github.com/guides/using-the-egit-eclipse-plugin-with-github">Git Eclipse Plugin</a> &#8211; which I still need to do) then pull down the code by using the command:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">git clone git://github.com/gjastrab/imagecombobox.git</pre></div></div>

<p>If you aren&#8217;t on the git bandwagon yet, then just right-click and save as&#8230; to download the <a href="http://blog.smartlogicsolutions.com/wp-content/uploads/2008/11/ImageComboBox.as">ImageComboBox.as</a> file for now.</p>
<p>I plan on improving it soon to have it respect the positioning of a label or to optionally hide the label.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2008/09/25/rotate-effect-and-non-embedded-fonts-in-flex-4/" rel="bookmark" class="crp_title">Rotate Effect and Non Embedded Fonts in Flex 4</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/05/28/flex-4-login-form-component/" rel="bookmark" class="crp_title">Flex 4 Login Form Component</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/16/skinning-button-flex-4-fxg/" rel="bookmark" class="crp_title">Skinning A Button in Flex 4 Using FXG</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/19/creating-custom-flex-4-skinnable-component/" rel="bookmark" class="crp_title">Creating Your First Custom SkinnableComponent in Flex 4</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/16/creating-custom-layout-in-flex-4-gumbo/" rel="bookmark" class="crp_title">Creating a Custom Layout Class in Flex 4</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2008/12/01/displaying-an-image-in-a-combobox/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Presenting an Intro to Flex at Refresh Baltimore Tonight</title>
		<link>http://blog.smartlogicsolutions.com/2008/11/12/presenting-an-intro-to-flex-at-refresh-baltimore-tonight/</link>
		<comments>http://blog.smartlogicsolutions.com/2008/11/12/presenting-an-intro-to-flex-at-refresh-baltimore-tonight/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 17:03:07 +0000</pubDate>
		<dc:creator>Greg Jastrab</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Greg Jastrab]]></category>
		<category><![CDATA[Presentations]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=374</guid>
		<description><![CDATA[I&#8217;ll be presenting an introduction to Flex tonight at Refresh Baltimore. If you&#8217;ve been wondering what Flex is and have been meaning to look into it, this presentation will be right up your alley. The presentation slides and code will be posted at http://www.smartlogicsolutions.com/wiki/Intro_to_Flex after the presentation. RSVP at http://www.localist.com/event/6229 if you can make it. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll be presenting an introduction to Flex tonight at <a href="http://www.refreshbmore.org">Refresh Baltimore</a>.  If you&#8217;ve been wondering what Flex is and have been meaning to look into it, this presentation will be right up your alley.</p>
<p>The presentation slides and code will be posted at <a href="http://www.smartlogicsolutions.com/wiki/Intro_to_Flex">http://www.smartlogicsolutions.com/wiki/Intro_to_Flex</a> after the presentation.</p>
<p>RSVP at <a href="http://www.localist.com/event/6229">http://www.localist.com/event/6229</a> if you can make it.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2008/02/06/amf-presentation-flex-blazeds-rubyamf-amfphp-coldfusion/" rel="bookmark" class="crp_title">Presentation on AMF Using BlazeDS, AMFPHP, RubyAMF, and ColdFusion</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/04/05/openflux-flex-mvc-component/" rel="bookmark" class="crp_title">Flex MVC Component Architecture Using OpenFlux</a></li><li><a href="http://blog.smartlogicsolutions.com/2007/05/20/certified-adobe-flex-2-developer/" rel="bookmark" class="crp_title">Certified Adobe Flex 2 Developer</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/09/24/google-analytics-event-tracking-overview/" rel="bookmark" class="crp_title">Google Analytics Event Tracking Overview</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/10/21/advanced-css-in-flex-4-id-and-descendant-selectors/" rel="bookmark" class="crp_title">Advanced CSS in Flex 4 &#8211; ID and Descendant Selectors</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2008/11/12/presenting-an-intro-to-flex-at-refresh-baltimore-tonight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 3: Styling Individual Tabs in a TabBar</title>
		<link>http://blog.smartlogicsolutions.com/2008/11/10/flex-3-styling-individual-tabs-in-a-tabbar/</link>
		<comments>http://blog.smartlogicsolutions.com/2008/11/10/flex-3-styling-individual-tabs-in-a-tabbar/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 15:36:54 +0000</pubDate>
		<dc:creator>Glenn Gentzke</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Glenn Gentzke]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[flex 2]]></category>
		<category><![CDATA[flex 3]]></category>
		<category><![CDATA[tab]]></category>
		<category><![CDATA[tabBar]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=357</guid>
		<description><![CDATA[There are a few ways to style the tabs in a TabBar that are fairly well hidden. Here are a couple methods that hopefully save some time for those of you out there looking to apply advanced styles tabs in Flex. If you need to style the tabs uniformly, then you&#8217;ve got little work to [...]]]></description>
			<content:encoded><![CDATA[<p>There are a few ways to style the tabs in a TabBar that are fairly well hidden.  Here are a couple methods that hopefully save some time for those of you out there looking to apply advanced styles tabs in Flex.</p>
<p>If you need to style the tabs uniformly, then you&#8217;ve got little work to do.  Just set the <strong>StyleName</strong> attribute on the TabBar itself and just define it in your stylesheet.</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:TabBar</span> id=<span style="color: #ff0000;">&quot;tabBar&quot;</span> styleName=<span style="color: #ff0000;">&quot;myTabBarStyle&quot;</span>  <span style="color: #7400FF;">/&gt;</span></span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.myTabBarStyle</span> <span style="color: #00AA00;">&#123;</span>
	tabHeight<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">28</span><span style="color: #00AA00;">;</span>
	cornerRadius<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	horizontalGap<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	horizontalAlign<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
	backgroundAlpha<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
	backgroundColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#357cc6</span><span style="color: #00AA00;">;</span>
	borderStyle<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	borderThickness<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	dropShadowEnabled<span style="color: #00AA00;">:</span> false<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Now that&#8217;s all good and well when all your tabs look the same.  What if you want to apply styles to tabs individually?  Well, if you&#8217;ve got 3 tabs or less you can use some css selectors to reference the book ends specifically, and let the general style apply to the middle tab.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.myTabBarStyle<span style="color: #00AA00;">&#123;</span>
    ...
  tabStyleName<span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;greenTab&quot;</span><span style="color: #00AA00;">;</span>
  firstTabStyleName<span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;blueTab&quot;</span><span style="color: #00AA00;">;</span>
  lastTabStyleName<span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;yellowTab&quot;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.greenTab</span> <span style="color: #00AA00;">&#123;</span>
  fillColors<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#a5d414</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#87c408</span><span style="color: #00AA00;">;</span>
  backgroundColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#87c408</span><span style="color: #00AA00;">;</span>
   borderColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#87c408</span><span style="color: #00AA00;">;</span>
  themeColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#a5d414</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.blueTab</span> <span style="color: #00AA00;">&#123;</span>
  fillColors<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#5a9cd6</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#357cc6</span><span style="color: #00AA00;">;</span>
  backgroundColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#357cc6</span><span style="color: #00AA00;">;</span>
  borderColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#357cc6</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>
  textRollOverColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>
  themeColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#5a9cd6</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.yellowTab</span> <span style="color: #00AA00;">&#123;</span>
  fillColors<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#333333</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#333333</span><span style="color: #00AA00;">;</span>
  backgroundColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#333333</span><span style="color: #00AA00;">;</span>
  borderColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#646464</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#F8ED6D</span><span style="color: #00AA00;">;</span>
  textRollOverColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#F8ED6D</span><span style="color: #00AA00;">;</span>
  themeColor<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#646464</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>When you have 4 or more tags, you need to set their styles by getting a reference to the tab <em>itself</em> and call the <strong>setStyle()</strong> method.  Straight forward? Yes. Easy to find information about? No&#8230; in fact I ran into trouble because there wasn&#8217;t any documentation available for an individual tab&#8217;s class and FlexBuilder 3 has no source code for the mx.controls.tabBarClasses package.</p>
<p>Import the Tab code, get a reference to the tab you wish to style, and call setStyle() for each attribute you want to change. Let&#8217;s say you have 4 tabs and each has a different style.  You can combine all 3 methods of styling by using the css code above to set the tab style for all tabs in the tabBar, override styles for the first and last tabs, then specifically grab the 3rd tab and override its style in the component:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">  <span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
    <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">tabBarClasses</span>.<span style="color: #0066CC;">Tab</span>
&nbsp;
       <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> tabBarCreationComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	  <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">tab</span>:<span style="color: #0066CC;">Tab</span> = tabBar.<span style="color: #006600;">getChildAt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> as <span style="color: #0066CC;">Tab</span>;			  
	  <span style="color: #0066CC;">tab</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;fillColors&quot;</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;#edb000&quot;</span>, <span style="color: #ff0000;">&quot;#e69500&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
          <span style="color: #0066CC;">tab</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;backgroundColor&quot;</span>, <span style="color: #ff0000;">&quot;#e69500&quot;</span><span style="color: #66cc66;">&#41;</span>;
          <span style="color: #0066CC;">tab</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;borderColor&quot;</span>, <span style="color: #ff0000;">&quot;#e69500&quot;</span><span style="color: #66cc66;">&#41;</span>;
          <span style="color: #0066CC;">tab</span>.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;themeColor&quot;</span>, <span style="color: #ff0000;">&quot;#edb000&quot;</span><span style="color: #66cc66;">&#41;</span>;
       <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
  <span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>And update the TabBar control:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;">  <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:TabBar</span> id=<span style="color: #ff0000;">&quot;tabBar&quot;</span> </span>
<span style="color: #000000;">                     styleName=<span style="color: #ff0000;">&quot;myTabBarStyle&quot;</span></span>
<span style="color: #000000;">                     creationComplete=<span style="color: #ff0000;">&quot;tabBarCreationComplete();&quot;</span>  <span style="color: #7400FF;">/&gt;</span></span></pre></div></div>

<p>You can iterate through each tab in the TabBar and set each tab individually if desired.  I hope this helps some Flex developers out there who are confused by styling many tabs individually!</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2010/01/22/ubuntu-byobu-landscape/" rel="bookmark" class="crp_title">Using Byobu and Landscape to improve remote Ubuntu sessions</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/16/skinning-button-flex-4-fxg/" rel="bookmark" class="crp_title">Skinning A Button in Flex 4 Using FXG</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/10/21/advanced-css-in-flex-4-id-and-descendant-selectors/" rel="bookmark" class="crp_title">Advanced CSS in Flex 4 &#8211; ID and Descendant Selectors</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/19/creating-custom-flex-4-skinnable-component/" rel="bookmark" class="crp_title">Creating Your First Custom SkinnableComponent in Flex 4</a></li><li><a href="http://blog.smartlogicsolutions.com/2007/06/06/eclipse-32-and-out-of-memory-errors/" rel="bookmark" class="crp_title">Eclipse 3.2 and &#8220;Out Of Memory&#8221; errors</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2008/11/10/flex-3-styling-individual-tabs-in-a-tabbar/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Migrating Serialization Changes Within an AIR Application</title>
		<link>http://blog.smartlogicsolutions.com/2008/09/11/migrating-serialization-changes-within-an-air-application/</link>
		<comments>http://blog.smartlogicsolutions.com/2008/09/11/migrating-serialization-changes-within-an-air-application/#comments</comments>
		<pubDate>Thu, 11 Sep 2008 06:50:07 +0000</pubDate>
		<dc:creator>Greg Jastrab</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Greg Jastrab]]></category>
		<category><![CDATA[Serialization]]></category>
		<category><![CDATA[Migration]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=255</guid>
		<description><![CDATA[I just submitted my entry to the AIR Cookbook for the AIR Cookbook Cook-off. It solves the problem of having your AIR application store an IExternalizable class on disk but then later adding more fields to that class. How would you read the old version of the class without encountering a runtime error if you [...]]]></description>
			<content:encoded><![CDATA[<p>I just submitted <a href="http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&#038;postid=10743&#038;loc=en_US&#038;productid=4">my entry</a> to the <a href="http://www.adobe.com/go/air_cookbook">AIR Cookbook</a> for the <a href="http://www.adobe.com/devnet/logged_in/mkoch_aircookoff.html">AIR Cookbook Cook-off</a>.</p>
<p>It solves the problem of having your AIR application store an <code>IExternalizable</code> class on disk but then later adding more fields to that class.  How would you read the old version of the class without encountering a runtime error if you tried to read the new field that wasn&#8217;t present in the older serialization?</p>
<p>Go <a href="http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&#038;postid=10743&#038;loc=en_US&#038;productid=4">check it out</a> the cookbook entry to find out how to do this and please rate the article!</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2008/10/29/i-won-the-air-cook-off/" rel="bookmark" class="crp_title">I Won the AIR Cook-off</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/11/17/migrairable-library-added-to-google-code/" rel="bookmark" class="crp_title">MigrAIRable Library Added to Google Code</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/02/25/flex-air-released-adobe/" rel="bookmark" class="crp_title">AIR 1.0 and Flex 3 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/03/31/air-linux-adobe-alpha-flexbuilder/" rel="bookmark" class="crp_title">Adobe AIR Alpha Released on Linux</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/08/27/serialization-errorbug-when-using-bytearray-readobject-iexternalizable-class/" rel="bookmark" class="crp_title">Serialization Error/Bug When Using a ByteArray and readObject in an IExternalizable Class?</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2008/09/11/migrating-serialization-changes-within-an-air-application/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Serialization Error/Bug When Using a ByteArray and readObject in an IExternalizable Class?</title>
		<link>http://blog.smartlogicsolutions.com/2008/08/27/serialization-errorbug-when-using-bytearray-readobject-iexternalizable-class/</link>
		<comments>http://blog.smartlogicsolutions.com/2008/08/27/serialization-errorbug-when-using-bytearray-readobject-iexternalizable-class/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 14:21:46 +0000</pubDate>
		<dc:creator>Greg Jastrab</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Greg Jastrab]]></category>
		<category><![CDATA[Serialization]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=200</guid>
		<description><![CDATA[I&#8217;ve encountered some odd behavior that I would have expected to work when calling readObject() to de-serialize an array of anonymous objects. If anyone knows what&#8217;s going on here, please enlighten me. I&#8217;ve also filed a bug on Adobe&#8217;s bug tracking system if anyone wants to follow the progress at Adobe&#8217;s end. I&#8217;m trying to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve encountered some odd behavior that I would have expected to work when calling <code>readObject()</code> to de-serialize an array of anonymous objects.  If anyone knows what&#8217;s going on here, please enlighten me.  I&#8217;ve also <a href="http://bugs.adobe.com/jira/browse/FP-601">filed a bug</a> on Adobe&#8217;s bug tracking system if anyone wants to follow the progress at Adobe&#8217;s end.</p>
<p>I&#8217;m trying to read all of the bytes in the <code>readExternal()</code> function of a class implementing <code>IExternalizable</code>, so that I may use the <code>position</code> property to move back in stream in case I need to do so.  The problem only seems to occur if I am trying to de-serialize an Array of anonymous objects.  If I put plain old Strings in the Array it will work fine.  I find this odd since I would expect</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> readExternal<span style="color: #66cc66;">&#40;</span>input:IDataInput<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">var</span> arr:<span style="color: #0066CC;">Array</span> = input.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as <span style="color: #0066CC;">Array</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>to have the exact same behavior as:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> readExternal<span style="color: #66cc66;">&#40;</span>input:IDataInput<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">var</span> ba:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; 
  <span style="color: #000000; font-weight: bold;">var</span> inputBytes:uint = input.<span style="color: #006600;">bytesAvailable</span>;
  input.<span style="color: #006600;">readBytes</span><span style="color: #66cc66;">&#40;</span>ba<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #000000; font-weight: bold;">var</span> baBytes:uint = ba.<span style="color: #006600;">bytesAvailable</span>;
  <span style="color: #000000; font-weight: bold;">var</span> arr:<span style="color: #0066CC;">Array</span> = ba.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as <span style="color: #0066CC;">Array</span>;
  <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;inputBytes == baBytes ?= &quot;</span> + <span style="color: #66cc66;">&#40;</span>inputBytes == baBytes<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// traces &quot;inputBytes == baBytes ?= true</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>AIR installer and code attached below&#8230; <span id="more-200"></span></p>
<p>The classes I&#8217;m trying to serialize are simple as I&#8217;m only trying to serialize an Array in this test application.  (Excuse the poor code of assuming the items in the Array are Objects in the <code>toString()</code function).</p>
<h4>io/WorkingSerializer.as</h4>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package io <span style="color: #66cc66;">&#123;</span>
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">IExternalizable</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">IDataInput</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">IDataOutput</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> WorkingSerializer <span style="color: #0066CC;">implements</span> IExternalizable <span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> arr:<span style="color: #0066CC;">Array</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> WorkingSerializer<span style="color: #66cc66;">&#40;</span>a:<span style="color: #0066CC;">Array</span>=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			arr = a ? a : <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> readExternal<span style="color: #66cc66;">&#40;</span>input:IDataInput<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			arr = input.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as <span style="color: #0066CC;">Array</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> writeExternal<span style="color: #66cc66;">&#40;</span>output:IDataOutput<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			output.<span style="color: #006600;">writeObject</span><span style="color: #66cc66;">&#40;</span>arr<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> s:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span>;
			<span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> obj:<span style="color: #0066CC;">Object</span> <span style="color: #b1b100;">in</span> arr<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				s += <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>{ &quot;</span>;
				<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> p:<span style="color: #0066CC;">String</span> <span style="color: #b1b100;">in</span> obj<span style="color: #66cc66;">&#41;</span>
					s += p + <span style="color: #ff0000;">&quot;: &quot;</span> + obj<span style="color: #66cc66;">&#91;</span>p<span style="color: #66cc66;">&#93;</span> + <span style="color: #ff0000;">&quot;,&quot;</span>;
				s += <span style="color: #ff0000;">&quot; }<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #ff0000;">&quot;[WorkingSerializer]<span style="color: #000099; font-weight: bold;">\n</span> arr: [ &quot;</span> + s + <span style="color: #ff0000;">&quot;]&quot;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<h4>io/ProblemSerializer.as</h4>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package io <span style="color: #66cc66;">&#123;</span>
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">ByteArray</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">IExternalizable</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">IDataInput</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">IDataOutput</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ProblemSerializer <span style="color: #0066CC;">implements</span> IExternalizable <span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> arr:<span style="color: #0066CC;">Array</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ProblemSerializer<span style="color: #66cc66;">&#40;</span>a:<span style="color: #0066CC;">Array</span>=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			arr = a ? a : <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> readExternal<span style="color: #66cc66;">&#40;</span>input:IDataInput<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> ba:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			input.<span style="color: #006600;">readBytes</span><span style="color: #66cc66;">&#40;</span>ba<span style="color: #66cc66;">&#41;</span>;
			arr = ba.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as <span style="color: #0066CC;">Array</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> writeExternal<span style="color: #66cc66;">&#40;</span>output:IDataOutput<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			output.<span style="color: #006600;">writeObject</span><span style="color: #66cc66;">&#40;</span>arr<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> s:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span>;
			<span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> obj:<span style="color: #0066CC;">Object</span> <span style="color: #b1b100;">in</span> arr<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				s += <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>{ &quot;</span>;
				<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> p:<span style="color: #0066CC;">String</span> <span style="color: #b1b100;">in</span> obj<span style="color: #66cc66;">&#41;</span>
					s += p + <span style="color: #ff0000;">&quot;: &quot;</span> + obj<span style="color: #66cc66;">&#91;</span>p<span style="color: #66cc66;">&#93;</span> + <span style="color: #ff0000;">&quot;,&quot;</span>;
				s += <span style="color: #ff0000;">&quot; }<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #ff0000;">&quot;[ProblemSerializer]<span style="color: #000099; font-weight: bold;">\n</span> arr: [ &quot;</span> + s + <span style="color: #ff0000;">&quot;]&quot;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>And here is the main application file.  I wrote it as an <a href="http://www.adobe.com/go/air">AIR</a> application so install AIR first if you don't have it.</p>
<h4>SerializationIssue.mxml</h4>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:WindowedApplication xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> creationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span>
						layout=<span style="color: #ff0000;">&quot;vertical&quot;</span> horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;500&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;500&quot;</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
			<span style="color: #0066CC;">import</span> io.<span style="color: #66cc66;">*</span>;
&nbsp;
			<span style="color: #0066CC;">private</span> const WORKING:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;workingfile_v1&quot;</span>;
			<span style="color: #0066CC;">private</span> const PROBLEM:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;problemfile_v1&quot;</span>;
&nbsp;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
				registerClassAlias<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;io.WorkingSerializer&quot;</span>, io.<span style="color: #006600;">WorkingSerializer</span><span style="color: #66cc66;">&#41;</span>;
				registerClassAlias<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;io.ProblemSerializer&quot;</span>, io.<span style="color: #006600;">ProblemSerializer</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
				<span style="color: #000000; font-weight: bold;">var</span> wo:WorkingSerializer = <span style="color: #000000; font-weight: bold;">new</span> WorkingSerializer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#123;</span>obj: <span style="color: #ff0000;">&quot;some&quot;</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span>obj: <span style="color: #ff0000;">&quot;items&quot;</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span>obj: <span style="color: #ff0000;">&quot;are&quot;</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span>obj: <span style="color: #ff0000;">&quot;here&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #000000; font-weight: bold;">var</span> s:FileStream = <span style="color: #000000; font-weight: bold;">new</span> FileStream<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				s.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span>getFile<span style="color: #66cc66;">&#40;</span>WORKING<span style="color: #66cc66;">&#41;</span>, FileMode.<span style="color: #006600;">WRITE</span><span style="color: #66cc66;">&#41;</span>;
				s.<span style="color: #006600;">writeObject</span><span style="color: #66cc66;">&#40;</span>wo<span style="color: #66cc66;">&#41;</span>;
				s.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
				<span style="color: #000000; font-weight: bold;">var</span> po:ProblemSerializer = <span style="color: #000000; font-weight: bold;">new</span> ProblemSerializer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#123;</span>obj: <span style="color: #ff0000;">&quot;items&quot;</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span>obj: <span style="color: #ff0000;">&quot;in&quot;</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span>obj: <span style="color: #ff0000;">&quot;problem&quot;</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #66cc66;">&#123;</span>obj: <span style="color: #ff0000;">&quot;serializer&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
				s.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span>getFile<span style="color: #66cc66;">&#40;</span>PROBLEM<span style="color: #66cc66;">&#41;</span>, FileMode.<span style="color: #006600;">WRITE</span><span style="color: #66cc66;">&#41;</span>;
				s.<span style="color: #006600;">writeObject</span><span style="color: #66cc66;">&#40;</span>po<span style="color: #66cc66;">&#41;</span>;
				s.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getFile<span style="color: #66cc66;">&#40;</span>filename:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:File <span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> File.<span style="color: #006600;">applicationStorageDirectory</span>.<span style="color: #006600;">resolvePath</span><span style="color: #66cc66;">&#40;</span>filename<span style="color: #66cc66;">&#41;</span>; <span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> readObj<span style="color: #66cc66;">&#40;</span>readWorking:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> s:FileStream = <span style="color: #000000; font-weight: bold;">new</span> FileStream<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				s.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span>getFile<span style="color: #66cc66;">&#40;</span>readWorking ? WORKING : PROBLEM<span style="color: #66cc66;">&#41;</span>, FileMode.<span style="color: #006600;">READ</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
				<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>readWorking<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
					<span style="color: #000000; font-weight: bold;">var</span> wo:WorkingSerializer = s.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as WorkingSerializer;
					logger.<span style="color: #0066CC;">text</span> += wo + <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
					<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>wo<span style="color: #66cc66;">&#41;</span>;
				<span style="color: #66cc66;">&#125;</span>
				<span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
					<span style="color: #000000; font-weight: bold;">var</span> po:ProblemSerializer = s.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as ProblemSerializer;
					logger.<span style="color: #0066CC;">text</span> += po + <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
					<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>po<span style="color: #66cc66;">&#41;</span>;
				<span style="color: #66cc66;">&#125;</span>
				s.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>mx:HBox<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> label=<span style="color: #ff0000;">&quot;Read Working Serializer&quot;</span> click=<span style="color: #ff0000;">&quot;readObj(true)&quot;</span> <span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> label=<span style="color: #ff0000;">&quot;Read Problem Serializer&quot;</span> click=<span style="color: #ff0000;">&quot;readObj()&quot;</span> <span style="color: #66cc66;">/&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:HBox<span style="color: #66cc66;">&gt;</span>
&nbsp;
	<span style="color: #66cc66;">&lt;</span>mx:Panel title=<span style="color: #ff0000;">&quot;Logging&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>mx:TextArea id=<span style="color: #ff0000;">&quot;logger&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> editable=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #0066CC;">wordWrap</span>=<span style="color: #ff0000;">&quot;true&quot;</span>
					 updateComplete=<span style="color: #ff0000;">&quot;logger.verticalScrollPosition=logger.maxVerticalScrollPosition&quot;</span> <span style="color: #66cc66;">/&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>mx:Panel<span style="color: #66cc66;">&gt;</span>
&nbsp;
<span style="color: #66cc66;">&lt;/</span>mx:WindowedApplication<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>To test this out without having to compile it yourself, I've compiled it as an AIR installer: <a href='http://blog.smartlogicsolutions.com/wp-content/uploads/2008/08/serializationissue.air'>Serialization Issue AIR Application</a>.  And the source: <a href='http://blog.smartlogicsolutions.com/wp-content/uploads/2008/08/serializationissue.zip'>Serialization Issue Source</a>.</p>
<p>When I run the code below and click on the "Read Working Serializer" button I correctly see:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>WorkingSerializer<span style="color: #66cc66;">&#93;</span>
 arr: <span style="color: #66cc66;">&#91;</span> 
	<span style="color: #66cc66;">&#123;</span> obj: some, <span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#123;</span> obj: items, <span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#123;</span> obj: are, <span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#123;</span> obj: here, <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#93;</span></pre></div></div>

<p>get output to the console.  But, if I click on the "Read Problem Serializer" button I get the following RangeError:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">RangeError: <span style="color: #0066CC;">Error</span> <span style="color: #808080; font-style: italic;">#2006: The supplied index is out of bounds. </span>
at flash.<span style="color: #006600;">utils</span>::ByteArray<span style="color: #66cc66;">/</span>readObject<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> 
at io::ProblemSerializer<span style="color: #66cc66;">/</span>readExternal<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&lt;</span>path to environment<span style="color: #66cc66;">&gt;/</span>SerializationIssue<span style="color: #66cc66;">/</span>src<span style="color: #66cc66;">/</span>io<span style="color: #66cc66;">/</span>ProblemSerializer.<span style="color: #006600;">as</span>:<span style="color: #cc66cc;">19</span><span style="color: #66cc66;">&#93;</span> 
at flash.<span style="color: #006600;">filesystem</span>::FileStream<span style="color: #66cc66;">/</span>readObject<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> 
at SerializationIssue<span style="color: #66cc66;">/</span>readObj<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&lt;</span>path to environment<span style="color: #66cc66;">&gt;/</span>SerializationIssue<span style="color: #66cc66;">/</span>src<span style="color: #66cc66;">/</span>SerializationIssue.<span style="color: #006600;">mxml</span>:<span style="color: #cc66cc;">40</span><span style="color: #66cc66;">&#93;</span> 
at SerializationIssue<span style="color: #66cc66;">/</span>___SerializationIssue_Button2_click<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&lt;</span>path to environment<span style="color: #66cc66;">&gt;/</span>SerializationIssue<span style="color: #66cc66;">/</span>src<span style="color: #66cc66;">/</span>SerializationIssue.<span style="color: #006600;">mxml</span>:<span style="color: #cc66cc;">51</span><span style="color: #66cc66;">&#93;</span></pre></div></div>

<p>In the meantime I'll find a workaround for this, but has anyone encountered anything similar to this or know why this isn't working?</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2008/07/16/creating-custom-layout-in-flex-4-gumbo/" rel="bookmark" class="crp_title">Creating a Custom Layout Class in Flex 4</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/11/losing-data-drag-and-drop-custom-class-flex-serialization/" rel="bookmark" class="crp_title">Losing Data When Drag and Dropping Custom Classes in Flex?</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/19/creating-custom-flex-4-skinnable-component/" rel="bookmark" class="crp_title">Creating Your First Custom SkinnableComponent in Flex 4</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/05/28/flex-4-login-form-component/" rel="bookmark" class="crp_title">Flex 4 Login Form Component</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/08/16/recreating-elys-flex-4-list-component-series/" rel="bookmark" class="crp_title">Recreating Ely&#8217;s Flex 4 List Component Series</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2008/08/27/serialization-errorbug-when-using-bytearray-readobject-iexternalizable-class/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

