<?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>Thanks, Mister! &#187; AIR</title>
	<atom:link href="http://www.thanksmister.com/index.php/archive/tag/air/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thanksmister.com</link>
	<description>Adobe Flex &#38; AIR Development</description>
	<lastBuildDate>Mon, 19 Jul 2010 17:28:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Screen Capture with AIR 2 NativeProcess</title>
		<link>http://www.thanksmister.com/index.php/archive/screen-capture-with-air-2-nativeprocess/</link>
		<comments>http://www.thanksmister.com/index.php/archive/screen-capture-with-air-2-nativeprocess/#comments</comments>
		<pubDate>Tue, 25 May 2010 01:20:57 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Command-line interface]]></category>
		<category><![CDATA[Screenshot]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=807</guid>
		<description><![CDATA[Prior to AIR 2 the only way to capture the screen was to use something like Marapi Java Bridge that acts as a conduit between your application and the native system. However, AIR 2 now lets us call With AIR 2 Beta and the upcoming AIR 2 release, you can now use the command-line tool [...]]]></description>
			<content:encoded><![CDATA[<p>Prior to AIR 2 the only way to capture the screen was to use something like <a href="http://blog.everythingflex.com/2008/04/24/do-a-screen-capture-with-adobe-air/">Marapi Java Bridge</a> that acts as a conduit between your application and the native system.  However, AIR 2 now lets us call</p>
<p>With AIR 2 Beta and the upcoming AIR 2 release, you can now use the command-line tool &#8220;screencapture&#8221; that comes with Mac OS.   Nothing extra needs to be bundled with the application for this to work on a Mac, but on Windows, you need an additional piece of code to execute the screen capture process.</p>
<p>The process of doing a screen capture is pretty easy.   You first create a File object that points to the location of the &#8220;screencapture&#8221; command line on the Mac:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> file:File = File.<span style="color: #006600;">applicationDirectory</span>;<br />
file = file.<span style="color: #006600;">resolvePath</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;usr/sbin/screencapture&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></td></tr></tbody></table></div>
<p>Then create a <a href="http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/desktop/NativeProcessStartupInfo.html">NativeProcessStartupInfo</a> object that will be used when we start the <a href="http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/desktop/NativeProcess.html">NativeProcess</a>.The arguments property of the NativeProcessStartupInfo takes a list of arguments that will be passed to the command line tool when its started.  For a complete list of arguments used by the screencapture command line tool, type &#8220;screencapture &#8211;help&#8221; in the terminal window.  For this example I wanted to push out a file named &#8220;screencap.png&#8221; to the desktop from a selection of the screen.  Optionally, you could capture the image to the clipboard and paste it directly.</p>
<p><span id="more-807"></span></p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> nativeProcessStartupInfo:NativeProcessStartupInfo = <span style="color: #000000; font-weight: bold;">new</span> NativeProcessStartupInfo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">var</span> args:Vector. = <span style="color: #000000; font-weight: bold;">new</span> Vector.<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&quot;-i&quot;</span>;<br />
args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&quot;screencapture.png&quot;</span>;<br />
<br />
nativeProcessStartupInfo.<span style="color: #0066CC;">arguments</span> = args;<br />
nativeProcessStartupInfo.<span style="color: #006600;">executable</span> = file;</div></td></tr></tbody></table></div>
<p>Now we can start the native process:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">process = <span style="color: #000000; font-weight: bold;">new</span> NativeProcess<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
process.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span>nativeProcessStartupInfo<span style="color: #66cc66;">&#41;</span>;</div></td></tr></tbody></table></div>
<p>The screencapture command tool will be launched and you will see the selection cursor on your screen.  After you make a selection, the file will automatically be saved to the desktop as &#8220;screencapture.png&#8221;.</p>
<p>Here is the complete project code:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span><br />
xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/mx&quot;</span> creationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span><span style="color: #66cc66;">&amp;</span>gt;<br />
<br />
<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span><br />
<br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> process:NativeProcess;<br />
<br />
<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><br />
<span style="color: #66cc66;">&#123;</span><br />
launchNativeProcess<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> launchNativeProcess<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>NativeProcess.<span style="color: #006600;">isSupported</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">var</span> file:File = File.<span style="color: #006600;">applicationDirectory</span>;<br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Capabilities</span>.<span style="color: #0066CC;">os</span>.<span style="color: #0066CC;">toLowerCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">indexOf</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;win&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&gt;</span> -<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<span style="color: #808080; font-style: italic;">//file = file.resolvePath(&quot;bin/mylocalexe.exe&quot;);</span><br />
<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Capabilities</span>.<span style="color: #0066CC;">os</span>.<span style="color: #0066CC;">toLowerCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">indexOf</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;mac&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&gt;</span> -<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
file = file.<span style="color: #006600;">resolvePath</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/usr/sbin/screencapture&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">var</span> args:Vector.<span style="color: #66cc66;">&lt;</span>String<span style="color: #66cc66;">&gt;</span> = <span style="color: #000000; font-weight: bold;">new</span> Vector.<span style="color: #66cc66;">&lt;</span>String<span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&quot;-i&quot;</span>;<br />
args<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&quot;screencapture.png&quot;</span>;<br />
<br />
<span style="color: #000000; font-weight: bold;">var</span> nativeProcessStartupInfo:NativeProcessStartupInfo = <span style="color: #000000; font-weight: bold;">new</span> NativeProcessStartupInfo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
nativeProcessStartupInfo.<span style="color: #0066CC;">arguments</span> = args;<br />
nativeProcessStartupInfo.<span style="color: #006600;">executable</span> = file;<br />
nativeProcessStartupInfo.<span style="color: #006600;">workingDirectory</span> = File.<span style="color: #006600;">desktopDirectory</span>;<br />
<br />
process = <span style="color: #000000; font-weight: bold;">new</span> NativeProcess<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
process.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span>nativeProcessStartupInfo<span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span></div></td></tr></tbody></table></div>
<p>To get something like this to work on Windows, you need to know a little bit of C or C# so you can call your own service and launch the screen print functionality on Windows. For more about using the NativeProcess in AIR 2 for both Windows and Mac, you check out this <a href="http://www.adobe.com/devnet/air/flex/quickstart/interacting_with_native_process.html">Adobe article</a>.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/ea2c0ce1-6d29-4a27-b680-848f9c046997/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=ea2c0ce1-6d29-4a27-b680-848f9c046997" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p><map name='google_ad_map_807_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/807?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_807_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=807&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fscreen-capture-with-air-2-nativeprocess%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/screen-capture-with-air-2-nativeprocess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIR:  Migrating Expired Certificates using AIR 1.5.3</title>
		<link>http://www.thanksmister.com/index.php/archive/migrating-expired-certificates-air153/</link>
		<comments>http://www.thanksmister.com/index.php/archive/migrating-expired-certificates-air153/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 08:39:19 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[Flex Builder 3]]></category>
		<category><![CDATA[Migrating Certificates]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=762</guid>
		<description><![CDATA[If you renew your certificate and you are running an earlier version of Adobe AIR than 1.5.3, you are in a world of hurt. The process of updating and renewing your certificate is enough of a pain, but trying to update your AIR application after your certificate expires prior to 1.5.3 required you to just [...]]]></description>
			<content:encoded><![CDATA[<p>If you renew your certificate and you are running an earlier version of Adobe AIR than 1.5.3, you are in a world of hurt.    The process of updating and renewing your certificate is enough of a pain, but trying to update your AIR application after your certificate expires prior to 1.5.3 required you to just uninstall your previous version and reinstall a new version of your application.    </p>
<p><strong>Adobe AIR 1.5.3 Update</strong></p>
<p>Luckily with AIR 1.5.3 you now have a grace period of 6 months to renew your certificate and still be able to publish an update to your application that users can install over the previous application.  The down side is that it&#8217;s is not easy to update your certificate once you update to 1.5.3.   You can read more about the Adobe AIR 1.5.3 update and changes to certificate migration here:</p>
<p><span id="more-762"></span></p>
<p><a href="http://www.adobe.com/support/documentation/en/air/1_5_3/releasenotes_developers.html">Release notes for Adobe AIR developers</a><br />
<a href="http://www.adobe.com/support/documentation/en/air/1_5_3/releasenotes_developers.html">Adobe AIR 1.5.3 Now Available</a></p>
<p><strong>Updating Flex Builder 3 for AIR 1.5.3</strong></p>
<p>First off, grab and install the latest and greatest AIR 1.5.3 from <a href="http://www.adobe.com/products/air/tools/sdk/">Adobe&#8217;s download sit</a>e.  You will also need to download the Adobe AIR 1.5.3 SDK to install within your Flex Builder 3.  If you just change the descriptor file and not update the SDK to use AIR 1.5.3, you will receive the following error when compiling the project from the IDE:  </p>
<blockquote><p><strong>invalid application descriptor: descriptor version does not match runtime version</strong></p>
<p>or </p>
<p><strong>EncryptedLocalStore may not use publisher IDs passed in from ADL</strong>
</p></blockquote>
<p>The instructions for updating Flex Builder 3 to use AIR 1.5.3 are not really clear, at least not for me.   The best way to upgrade on the MAC is to download the AIR 1.5.3 SDK and manually drag the files to your Flex Builder 3 SDK folder.   When you download the AIR 1.5.3 SDK and expand it, you can see the following folder structure:</p>
<p><img src="http://www.thanksmister.com/images/MigratingCertificates/AIRSDK153.png" alt="AIR SDK 1.5.3" /></p>
<p>You can just drag the folders one-by-one ( or the contents of the folder to be more careful ) to your Flex Builder 3 application directory inside the sdks folder.   Now restart your Flex Builder 3 and create a new dummy project.   If all goes well, your new project will have the 1.5.3 namespace already in the descriptor file.  Now for existing Flex Builder 3 projects,  you need to manually update your application&#8217;s namespace to 1.5.3  and add a new descriptor tag for publisherID (you don&#8217;t need to do this for a new AIR application, only if you are updating an project to AIR 1.5.3):</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><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><br />
<span style="color: #66cc66;">&lt;</span>application xmlns=<span style="color: #ff0000;">&quot;http://ns.adobe.com/air/application/1.5.3&quot;</span><span style="color: #66cc66;">&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span>-- The application identifier <span style="color: #0066CC;">string</span>, unique to <span style="color: #0066CC;">this</span> application. <span style="color: #006600;">Required</span>. --<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>id<span style="color: #66cc66;">&gt;</span>MyApplication<span style="color: #66cc66;">&lt;/</span>id<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>publisherID<span style="color: #66cc66;">&gt;</span>3782AD3EDB99182DA9E106898998986691F7E39C8DBA6A3.1<span style="color: #66cc66;">&lt;/</span>publisherID<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ...</div></td></tr></tbody></table></div>
<p>The publisherID is a combination of your application name and the publish id for the application.   You can find the publisherID manually by looking at your currently installed application directory on MAC (Windows users can find it in the release notes):</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">MaciontoshHD <span style="color: #66cc66;">&gt;</span> Users <span style="color: #66cc66;">&gt;</span> <span style="color: #66cc66;">&#91;</span>username<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&gt;</span> Library <span style="color: #66cc66;">&gt;</span> Application Support <span style="color: #66cc66;">&gt;</span> Adobe <span style="color: #66cc66;">&gt;</span> AIR <span style="color: #66cc66;">&gt;</span> ELS <span style="color: #66cc66;">&gt;</span> MyApplication.3782AD3EDB99182DA9E106898998986691F7E39C8DBA6A3.1</div></td></tr></tbody></table></div>
<p>The long number after the application name is the publisherID, copy this and add it to your application descriptor file.  You can also get the application <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=reading_app_settings_1.html">publisherID from the NativeApplication</a>:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">publisherID</span><span style="color: #66cc66;">&#41;</span>;</div></td></tr></tbody></table></div>
<p>It should be noted that bye adding the
<publisherID>&#8230;.</publisherID> to the descriptor file will create an error when compiling your application using Flex Builder 3:</p>
<p><strong>invocation forwarded to primary instance</strong></p>
<p>So this must be commented out of the descriptor file until you are ready to publish.  If you leave this commented out when you publish the application, you won&#8217;t be able to migrate the application. So I am not sure how tracing the publisherID is going to be a help to you from the IDE when testing. You should also update the debug version of your <a href="http://www.adobe.com/support/flashplayer/downloads.html">Flash Player</a> to the latest (10.0.42.34) before compiling your application.    Now you can test your application from the IDE and it should work.</p>
<p><strong>Migrating Expired Certificate</strong></p>
<p>Now your application should run from the IDE and you can prepare to publish the application using your renewed certificate.  Publish the application as normal using the renewed certificate to create the AIR compiled application.   Now you will need to migrate your previous expired certificate using the ADT migration tools.   The instructions for migrating certificates using the ADT migration tools can be found here:</p>
<p><a href="http://www.insideria.com/2009/04/migrating-air-application-cert.html">http://www.insideria.com/2009/04/migrating-air-application-cert.html</a></p>
<p>Once you successfully migrated your previous expired certificate, your compiled AIR application is ready to update your previous version of the installed application on your system.   If things didn&#8217;t go correctly, you will get an error that an application already exists with the same name, and you need to install the application in a different directory.   That would be bad, and you probably missed one of the delicate steps and need to go through it all again.   If you do get an update option to replace the existing application, you can no celebrate. </p>
<p><strong>My Opinion about Certificates</strong></p>
<p>In my opinion, using 3rd party certificate vendors (and paying for them) like Thawte, Verisign, ect. is total nonsense and just way to cumbersome.   Adobe could easily provide a way to authenticate the authors of AIR applications with minimal cost to developers.  This is especially important when you just want to publish an application for free and distribute it through the Adobe market place.    </p>
<p>Adobe could borrow some ideas from Android Market, especially since Adobe plans on allowing developers to create more and more Flash/Flex content for mobile devices.    Developers don&#8217;t need some complicated and expensive system in place to review code and authorize updates (i.e. iPhone app store), we simply need a way to verify to the end user that the author is who she says she is and the application is protected from someone else writing an application with identical name.    </p>
<p>The renewal process for a certificate and the above steps to migrate certificates is a total pain, and I think an unnecessary barrier for Adobe AIR application developers.  Anything Adobe could to do to lower the barrier for the average AIR developer to create certified applications would be greatly appreciated.    There are also other ways to freely publish and distribute your application freely as described on this post at polyGeek.com: </p>
<p><a href="http://polygeek.com/862_flex_deploying-trusted-air-apps-without-certification-for-free">http://polygeek.com/862_flex_deploying-trusted-air-apps-without-certification-for-free</a></p>
<p>-Mister</p>
<p><map name='google_ad_map_762_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/762?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_762_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=762&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fmigrating-expired-certificates-air153%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/migrating-expired-certificates-air153/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom AIR updater interface using ApplicationUpdater</title>
		<link>http://www.thanksmister.com/index.php/archive/custom-air-updater-interface-using-applicationupdater/</link>
		<comments>http://www.thanksmister.com/index.php/archive/custom-air-updater-interface-using-applicationupdater/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 02:22:25 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[ApplicationUpdater]]></category>
		<category><![CDATA[ApplicationUpdaterUI]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=710</guid>
		<description><![CDATA[To tell you the truth, I never gave the ApplicationUpdaterUI much thought in terms of memory use before this post. I just thought it was a great way to add a complete update system to your AIR applications. I had not thought it could be so memory intensive until a recent conversation with Jesse Warden [...]]]></description>
			<content:encoded><![CDATA[<p>To tell you the truth, I never gave the ApplicationUpdaterUI much thought in terms of memory use before this post.   I just thought it was a great way to add a complete update system to your AIR applications. I had not thought it could be so memory intensive until a recent conversation with <a href="http://jessewarden.com/"> Jesse Warden</a> on Twitter:</p>
<p><img src="http://www.thanksmister.com/examples/updatetester/jessetweet.png" alt="Tweet Conversation" /><br />
<em><br />
* Please note that Jesse is dude that looks about 17 and I am the older more distinguished gentleman.</em></p>
<p><strong>Problem with ApplicationUpdaterUI</strong></p>
<p>Indeed, that &#8220;mofo eats mad RAM&#8221; is putting it lightly.  It turns out that the <a href="http://help.adobe.com/en_US/AIR/1.5/jslr/air/update/ApplicationUpdaterUI.html">ApplicationUpdaterUI</a> consumes about 14MB of RAM within the application. Furthermore, for the ApplicationUpdaterUI to even check for available updates, it must loads the entire UI in memory even if not displayed. So just by using the framework, you end adding 14MB to your application that won&#8217;t be garbage collected.  Granted, in most cases 14MB of RAM is not that big of deal.  However, for smaller applications you might want to consider an alternative approach.</p>
<p>There happens to another class file called <a href="http://www.iteratif.fr/docs/air/update/ApplicationUpdater.html">ApplicationUpdater</a>.  This class basically gives you all the benefits of the ApplicationUpdaterUI framework without any of the visible elements.  This means you have to build your own user interface.  This might actually be a benefit in the long run as you may want to customize your application updater to match your application.  The other benefit is that you can use the ApplicationUpdater class to check for updates without loading any user interface.  The interface only needs to be loaded if there is an actual update available.</p>
<p><strong>Custom Updater Interface with ApplicationUpdater</strong></p>
<p>In building my own custom updater interface, I thought it might be nice to have the same look and feel of the ApplicationUpdaterUI along with some of the more polite features (like postpone update until restart).  Building your own updater using the ApplicationUpdater turns out to be a little more involved than I had originally thought. However, when you start attacking a problem you persevere until the end, no matter what the pain.   </p>
<p><span id="more-710"></span></p>
<p>I did find some available information in the Adobe AIR 1.5 Cookbook, which has a basic custom updater example.  This helped with some of the basic stuff, but I still needed a little more detail to make something similar to the ApplicationUpdaterUI.    I found another good example by <a href="http://www.websector.de/blog/2009/09/09/custom-applicationupdaterui-for-using-air-updater-framework-in-flex-4/">Jens Krause</a>, but this example is for Flex 4.  I needed something that would work for Flex 3. So here is what I built based on these examples:</p>
<p><img src="http://www.thanksmister.com/examples/updatetester/checkupdates.png" alt="Check Update" /><br />
<img src="http://www.thanksmister.com/examples/updatetester/downloadupdates.png" alt="Download Update" /><br />
<img src="http://www.thanksmister.com/examples/updatetester/installupdates.png" alt="Install Update" /></p>
<p>The application consists of one class file and one MXML dialog for displaying all the user interface elements.   I borrowed some of the icons from the ApplicationUpdaterUI which is available in the AIR SDK (I hope Adobe doesn&#8217;t mind).   The update dialog UI is only loaded when needed, all checks for application updates happen using the ApplicationUpdater.  The update dialog is only displayed when the user wants to manually update or the periodic update check finds a new application update.</p>
<p><strong>The Good and the Bad</strong></p>
<p>The good news is the updater only consumes about 2MB of RAM when you load the update dialog box, part of that is the ApplicationUpdater itself running in the background. The other good news is that you can yank out or customize any part of the this example to meet your own needs. The bad news is that even though I tried my best to fully remove the update dialog and have garbage collection clean it up, it doesn&#8217;t fully unload from memory (go figure). I don&#8217;t feel this is a huge issue as the application is most likely restarted after you install an update.  Below is the code followed by a zip file containing the full application.   </p>
<p><strong>UpdateManager.as</strong></p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br />107<br />108<br />109<br />110<br />111<br />112<br />113<br />114<br />115<br />116<br />117<br />118<br />119<br />120<br />121<br />122<br />123<br />124<br />125<br />126<br />127<br />128<br />129<br />130<br />131<br />132<br />133<br />134<br />135<br />136<br />137<br />138<br />139<br />140<br />141<br />142<br />143<br />144<br />145<br />146<br />147<br />148<br />149<br />150<br />151<br />152<br />153<br />154<br />155<br />156<br />157<br />158<br />159<br />160<br />161<br />162<br />163<br />164<br />165<br />166<br />167<br />168<br />169<br />170<br />171<br />172<br />173<br />174<br />175<br />176<br />177<br />178<br />179<br />180<br />181<br />182<br />183<br />184<br />185<br />186<br />187<br />188<br />189<br />190<br />191<br />192<br />193<br />194<br />195<br />196<br />197<br />198<br />199<br />200<br />201<br />202<br />203<br />204<br />205<br />206<br />207<br />208<br />209<br />210<br />211<br />212<br />213<br />214<br />215<br />216<br />217<br />218<br />219<br />220<br />221<br />222<br />223<br />224<br />225<br />226<br />227<br />228<br />229<br />230<br />231<br />232<br />233<br />234<br />235<br />236<br />237<br />238<br />239<br />240<br />241<br />242<br />243<br />244<br />245<br />246<br />247<br />248<br />249<br />250<br />251<br />252<br />253<br />254<br />255<br />256<br />257<br />258<br />259<br />260<br />261<br />262<br />263<br />264<br />265<br />266<br />267<br />268<br />269<br />270<br />271<br />272<br />273<br />274<br />275<br />276<br />277<br />278<br />279<br />280<br />281<br />282<br />283<br />284<br />285<br />286<br />287<br />288<br />289<br />290<br />291<br />292<br />293<br />294<br />295<br />296<br />297<br />298<br />299<br />300<br />301<br />302<br />303<br />304<br />305<br />306<br />307<br />308<br />309<br />310<br />311<br />312<br />313<br />314<br />315<br />316<br />317<br />318<br />319<br />320<br />321<br />322<br />323<br />324<br />325<br />326<br />327<br />328<br />329<br />330<br />331<br />332<br />333<br />334<br />335<br />336<br />337<br />338<br />339<br />340<br />341<br />342<br />343<br />344<br />345<br />346<br />347<br />348<br />349<br />350<br />351<br />352<br />353<br />354<br />355<br />356<br />357<br />358<br />359<br />360<br />361<br />362<br />363<br />364<br />365<br />366<br />367<br />368<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">package com.<span style="color: #006600;">thanksmister</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> air.<span style="color: #006600;">update</span>.<span style="color: #006600;">ApplicationUpdater</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> air.<span style="color: #006600;">update</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">DownloadErrorEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> air.<span style="color: #006600;">update</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">StatusFileUpdateErrorEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> air.<span style="color: #006600;">update</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">StatusFileUpdateEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> air.<span style="color: #006600;">update</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">StatusUpdateErrorEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> air.<span style="color: #006600;">update</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">StatusUpdateEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> air.<span style="color: #006600;">update</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">UpdateEvent</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">desktop</span>.<span style="color: #006600;">NativeApplication</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">ErrorEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">ProgressEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filesystem</span>.<span style="color: #006600;">File</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> UpdateManager<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> appUpdater:ApplicationUpdater;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> appVersion:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> baseURL:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> updaterDialog:UpdaterDialog;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> configurationFile:File;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> isFirstRun:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> upateVersion:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> applicationName:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> installedVersion:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> description:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> initializeCheckNow:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> isInstallPostponed:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> showCheckState:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Constructer for UpdateManager Class<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* @param showCheckState Boolean value to show the Check Now dialog box<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* @param initializeCheckNow Boolean value to initialize application and run check on instantiation of the Class<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> UpdateManager<span style="color: #66cc66;">&#40;</span>showCheckState:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">true</span>, initializeCheckNow:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">showCheckState</span> = showCheckState;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">configurationFile</span> = <span style="color: #000000; font-weight: bold;">new</span> File<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;app:/config/update.xml&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">initializeCheckNow</span> = initializeCheckNow;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initialize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> checkNow<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//trace(&quot;checkNow&quot;);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isInstallPostponed = <span style="color: #000000; font-weight: bold;">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>showCheckState<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createDialog<span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">CHECK_UPDATE</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">checkNow</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//---------- &nbsp;ApplicationUpdater ----------------//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> initialize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//trace(&quot;initialize&quot;);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>appUpdater<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater = <span style="color: #000000; font-weight: bold;">new</span> ApplicationUpdater<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">configurationFile</span> = configurationFile;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>UpdateEvent.<span style="color: #006600;">INITIALIZED</span>, updaterInitialized<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>StatusUpdateEvent.<span style="color: #006600;">UPDATE_STATUS</span>, statusUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>UpdateEvent.<span style="color: #006600;">BEFORE_INSTALL</span>, beforeInstall<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>StatusUpdateErrorEvent.<span style="color: #006600;">UPDATE_ERROR</span>, statusUpdateError<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>UpdateEvent.<span style="color: #006600;">DOWNLOAD_START</span>, downloadStarted<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ProgressEvent.<span style="color: #006600;">PROGRESS</span>, downloadProgress<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>UpdateEvent.<span style="color: #006600;">DOWNLOAD_COMPLETE</span>, downloadComplete<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>DownloadErrorEvent.<span style="color: #006600;">DOWNLOAD_ERROR</span>, downloadError<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ErrorEvent.<span style="color: #0066CC;">ERROR</span>, updaterError<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> beforeInstall<span style="color: #66cc66;">&#40;</span>event:UpdateEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//trace(&quot;beforeInstall&quot;);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>isInstallPostponed<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.<span style="color: #006600;">preventDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isInstallPostponed = <span style="color: #000000; font-weight: bold;">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> updaterInitialized<span style="color: #66cc66;">&#40;</span>event:UpdateEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//trace(&quot;updaterInitialized&quot;);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">isFirstRun</span> = event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">isFirstRun</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">applicationName</span> = getApplicationName<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">installedVersion</span> = getApplicationVersion<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>showCheckState <span style="color: #66cc66;">&amp;&amp;</span> initializeCheckNow<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createDialog<span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">CHECK_UPDATE</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>initializeCheckNow<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">checkNow</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> statusUpdate<span style="color: #66cc66;">&#40;</span>event:StatusUpdateEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//trace(&quot;statusUpdate&quot;);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;event.<span style="color: #006600;">preventDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">available</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">description</span> = getUpdateDescription<span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">details</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">upateVersion</span> = event.<span style="color: #0066CC;">version</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>showCheckState<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createDialog<span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">UPDATE_AVAILABLE</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>updaterDialog<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">applicationName</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">applicationName</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">installedVersion</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">installedVersion</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">upateVersion</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">upateVersion</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">description</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">description</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = UpdaterDialog.<span style="color: #006600;">UPDATE_AVAILABLE</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>showCheckState<span style="color: #66cc66;">&#41;</span> createDialog<span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">NO_UPDATE</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> statusUpdateError<span style="color: #66cc66;">&#40;</span>event:StatusUpdateErrorEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.<span style="color: #006600;">preventDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>updaterDialog<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createDialog<span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">UPDATE_ERROR</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = UpdaterDialog.<span style="color: #006600;">UPDATE_ERROR</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> statusFileUpdate<span style="color: #66cc66;">&#40;</span>event:StatusFileUpdateEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.<span style="color: #006600;">preventDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">available</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = UpdaterDialog.<span style="color: #006600;">UPDATE_DOWNLOADING</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">downloadUpdate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = UpdaterDialog.<span style="color: #006600;">UPDATE_ERROR</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> statusFileUpdateError<span style="color: #66cc66;">&#40;</span>event:StatusFileUpdateErrorEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.<span style="color: #006600;">preventDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = UpdaterDialog.<span style="color: #006600;">UPDATE_ERROR</span>;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> downloadStarted<span style="color: #66cc66;">&#40;</span>event:UpdateEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = UpdaterDialog.<span style="color: #006600;">UPDATE_DOWNLOADING</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> downloadProgress<span style="color: #66cc66;">&#40;</span>event:ProgressEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = UpdaterDialog.<span style="color: #006600;">UPDATE_DOWNLOADING</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> num:<span style="color: #0066CC;">Number</span> = <span style="color: #66cc66;">&#40;</span>event.<span style="color: #0066CC;">bytesLoaded</span><span style="color: #66cc66;">/</span>event.<span style="color: #0066CC;">bytesTotal</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">100</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">downloadProgress</span><span style="color: #66cc66;">&#40;</span>num<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> downloadComplete<span style="color: #66cc66;">&#40;</span>event:UpdateEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.<span style="color: #006600;">preventDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// prevent default install</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = UpdaterDialog.<span style="color: #006600;">INSTALL_UPDATE</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> downloadError<span style="color: #66cc66;">&#40;</span>event:DownloadErrorEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.<span style="color: #006600;">preventDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = UpdaterDialog.<span style="color: #006600;">UPDATE_ERROR</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> updaterError<span style="color: #66cc66;">&#40;</span>event:ErrorEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">errorText</span> = event.<span style="color: #0066CC;">text</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = UpdaterDialog.<span style="color: #006600;">UPDATE_ERROR</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//---------- &nbsp;UpdaterDialog Events ----------------//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createDialog<span style="color: #66cc66;">&#40;</span>state:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>updaterDialog<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog = <span style="color: #000000; font-weight: bold;">new</span> UpdaterDialog<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">isFirstRun</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">isFirstRun</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">applicationName</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">applicationName</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">installedVersion</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">installedVersion</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">upateVersion</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">upateVersion</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = state;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">description</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">description</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">EVENT_CHECK_UPDATE</span>, checkUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">EVENT_INSTALL_UPDATE</span>, installUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">EVENT_CANCEL_UPDATE</span>, cancelUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">EVENT_DOWNLOAD_UPDATE</span>, downloadUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">EVENT_INSTALL_LATER</span>, installLater<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Check for update.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> checkUpdate<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//trace(&quot;checkUpdate&quot;);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">checkNow</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Install the update.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> installUpdate<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">installUpdate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Install the update.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> installLater<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isInstallPostponed = <span style="color: #000000; font-weight: bold;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">installUpdate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; destoryUpdater<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Download the update.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> downloadUpdate<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">downloadUpdate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Cancel the update.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* */</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> cancelUpdate<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">cancelUpdate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; destoryUpdater<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//---------- &nbsp;Destroy All ----------------//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> destroy<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>appUpdater<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">configurationFile</span> = configurationFile;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>UpdateEvent.<span style="color: #006600;">INITIALIZED</span>, updaterInitialized<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>StatusUpdateEvent.<span style="color: #006600;">UPDATE_STATUS</span>, statusUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>StatusUpdateErrorEvent.<span style="color: #006600;">UPDATE_ERROR</span>, statusUpdateError<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>UpdateEvent.<span style="color: #006600;">DOWNLOAD_START</span>, downloadStarted<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>ProgressEvent.<span style="color: #006600;">PROGRESS</span>, downloadProgress<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>UpdateEvent.<span style="color: #006600;">DOWNLOAD_COMPLETE</span>, downloadComplete<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>DownloadErrorEvent.<span style="color: #006600;">DOWNLOAD_ERROR</span>, downloadError<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>UpdateEvent.<span style="color: #006600;">BEFORE_INSTALL</span>, beforeInstall<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>ErrorEvent.<span style="color: #0066CC;">ERROR</span>, updaterError<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; appUpdater = <span style="color: #000000; font-weight: bold;">null</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; destoryUpdater<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> destoryUpdater<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>updaterDialog<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">destroy</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">EVENT_CHECK_UPDATE</span>, checkUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">EVENT_INSTALL_UPDATE</span>, installUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">EVENT_CANCEL_UPDATE</span>, cancelUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">EVENT_DOWNLOAD_UPDATE</span>, downloadUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">EVENT_INSTALL_LATER</span>, installLater<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog = <span style="color: #000000; font-weight: bold;">null</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isInstallPostponed = <span style="color: #000000; font-weight: bold;">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//---------- &nbsp;Utilities ----------------//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Getter method to get the version of the application<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Based on Jens Krause blog post: http://www.websector.de/blog/2009/09/09/custom-applicationupdaterui-for-using-air-updater-framework-in-flex-4/<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* @return String Version of application<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getApplicationVersion<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> appXML:<span style="color: #0066CC;">XML</span> = NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">applicationDescriptor</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> ns:Namespace = appXML.<span style="color: #006600;">namespace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> appXML.<span style="color: #006600;">ns</span>::<span style="color: #0066CC;">version</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Getter method to get the name of the application file<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Based on Jens Krause blog post: http://www.websector.de/blog/2009/09/09/custom-applicationupdaterui-for-using-air-updater-framework-in-flex-4/<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* @return String name of application<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getApplicationFileName<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> appXML:<span style="color: #0066CC;">XML</span> = NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">applicationDescriptor</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> ns:Namespace = appXML.<span style="color: #006600;">namespace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> appXML.<span style="color: #006600;">ns</span>::filename;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Getter method to get the name of the application, this does not support multi-language.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Based on a method from Adobes ApplicationUpdaterDialogs.mxml, which is part of Adobes AIR Updater Framework<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Also based on Jens Krause blog post: http://www.websector.de/blog/2009/09/09/custom-applicationupdaterui-for-using-air-updater-framework-in-flex-4/<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* @return String name of application<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getApplicationName<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> applicationName:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> xmlNS:Namespace=<span style="color: #000000; font-weight: bold;">new</span> Namespace<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;http://www.w3.org/XML/1998/namespace&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> appXML:<span style="color: #0066CC;">XML</span>=NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">applicationDescriptor</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> ns:Namespace=appXML.<span style="color: #006600;">namespace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// filename is mandatory</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> elem:XMLList=appXML.<span style="color: #006600;">ns</span>::filename;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// use name is if it exists in the application descriptor</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>appXML.<span style="color: #006600;">ns</span>::<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">!</span>= 0<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elem=appXML.<span style="color: #006600;">ns</span>::<span style="color: #0066CC;">name</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// See if element contains simple content</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>elem.<span style="color: #006600;">hasSimpleContent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; applicationName=elem.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> applicationName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Helper method to get release notes, this does not support multi-language.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Based on a method from Adobes ApplicationUpdaterDialogs.mxml, which is part of Adobes AIR Updater Framework<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* Also based on Jens Krause blog post: http://www.websector.de/blog/2009/09/09/custom-applicationupdaterui-for-using-air-updater-framework-in-flex-4/<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* @param detail Array of details<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* @return String Release notes depending on locale chain<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> getUpdateDescription<span style="color: #66cc66;">&#40;</span>details:<span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">text</span>:<span style="color: #0066CC;">String</span>=<span style="color: #ff0000;">&quot;&quot;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>details.<span style="color: #0066CC;">length</span> == 1<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">text</span>=details<span style="color: #66cc66;">&#91;</span>0<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span>1<span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">text</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p><strong>UpdateDialog.mxml</strong></p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br />107<br />108<br />109<br />110<br />111<br />112<br />113<br />114<br />115<br />116<br />117<br />118<br />119<br />120<br />121<br />122<br />123<br />124<br />125<br />126<br />127<br />128<br />129<br />130<br />131<br />132<br />133<br />134<br />135<br />136<br />137<br />138<br />139<br />140<br />141<br />142<br />143<br />144<br />145<br />146<br />147<br />148<br />149<br />150<br />151<br />152<br />153<br />154<br />155<br />156<br />157<br />158<br />159<br />160<br />161<br />162<br />163<br />164<br />165<br />166<br />167<br />168<br />169<br />170<br />171<br />172<br />173<br />174<br />175<br />176<br />177<br />178<br />179<br />180<br />181<br />182<br />183<br />184<br />185<br />186<br />187<br />188<br />189<br />190<br />191<br />192<br />193<br />194<br />195<br />196<br />197<br />198<br />199<br />200<br />201<br />202<br />203<br />204<br />205<br />206<br />207<br />208<br />209<br />210<br />211<br />212<br />213<br />214<br />215<br />216<br />217<br />218<br />219<br />220<br />221<br />222<br />223<br />224<br />225<br />226<br />227<br />228<br />229<br />230<br />231<br />232<br />233<br />234<br />235<br />236<br />237<br />238<br />239<br />240<br />241<br />242<br />243<br />244<br />245<br />246<br />247<br />248<br />249<br />250<br />251<br />252<br />253<br />254<br />255<br />256<br />257<br />258<br />259<br />260<br />261<br />262<br />263<br />264<br />265<br />266<br />267<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><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><br />
<span style="color: #66cc66;">&lt;</span>mx:Window xmlns=<span style="color: #ff0000;">&quot;*&quot;</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogWindow&quot;</span><br />
&nbsp; &nbsp; layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> maximizable=<span style="color: #ff0000;">&quot;false&quot;</span> resizable=<span style="color: #ff0000;">&quot;false&quot;</span> currentState=<span style="color: #ff0000;">&quot;{_updateState}&quot;</span><br />
&nbsp; &nbsp; clipContent=<span style="color: #ff0000;">&quot;false&quot;</span> showStatusBar=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;530&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;180&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Metadata<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Event<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;checkUpdate&quot;</span>, <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;flash.events.Event&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Event<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;downloadUpdate&quot;</span>, <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;flash.events.Event&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Event<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;downloadUpdate&quot;</span>, <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;flash.events.Event&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Event<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;cancelUpdate&quot;</span>, <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;flash.events.Event&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:Metadata<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> EVENT_CHECK_UPDATE:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;checkUpdate&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> EVENT_INSTALL_UPDATE:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;installUpdate&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> EVENT_DOWNLOAD_UPDATE:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;downloadUpdate&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> EVENT_CANCEL_UPDATE:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;cancelUpdate&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> EVENT_INSTALL_LATER:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;installLater&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> UPDATE_DOWNLOADING:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;updateDownloading&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> INSTALL_UPDATE:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;installUpdate&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> UPDATE_AVAILABLE:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;updateAvailable&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> NO_UPDATE:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;noUpdate&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> CHECK_UPDATE:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;checkUpdate&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> UPDATE_ERROR:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;updateError&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _isFirstRun:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _installedVersion:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _updateVersion:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _updateDescription:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _applicationName:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _updateState:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _errorText:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;There was an error checking for updates.&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> isFirstRun<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _isFirstRun = value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> installedVersion<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _installedVersion = value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> upateVersion<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _updateVersion = value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> updateState<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _updateState = value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> applicationName<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _applicationName = value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> description<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _updateDescription = value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> errorText<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _errorText = value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> downloadProgress<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>progressBar<span style="color: #66cc66;">&#41;</span> progressBar.<span style="color: #006600;">setProgress</span><span style="color: #66cc66;">&#40;</span>value, 100<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> continueUpdate<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">currentState</span> == UpdaterDialog.<span style="color: #006600;">CHECK_UPDATE</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span>EVENT_CHECK_UPDATE<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">currentState</span> == UPDATE_AVAILABLE<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span>EVENT_DOWNLOAD_UPDATE<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">currentState</span> == INSTALL_UPDATE<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span>EVENT_INSTALL_UPDATE<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> cancelUpdate<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">currentState</span> == INSTALL_UPDATE<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span>EVENT_INSTALL_LATER<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span>EVENT_CANCEL_UPDATE<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> destroy<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iconImage.<span style="color: #006600;">unloadAndStop</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iconImage.<span style="color: #006600;">source</span> = <span style="color: #000000; font-weight: bold;">null</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continueButton.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, continueUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cancelButton.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, cancelUpdate<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// becaause we used skins, we have to clear them for garbage collection</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//http://www.firstrowria.com/2009/01/flex-top-5-memory-leaks-in-flex-2-skinning-of-components-eg-button/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continueButton.<span style="color: #006600;">styleName</span> = <span style="color: #000000; font-weight: bold;">null</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cancelButton.<span style="color: #006600;">styleName</span> = <span style="color: #000000; font-weight: bold;">null</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">numChildren</span> <span style="color: #66cc66;">&gt;</span> 0<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">removeChildAt</span><span style="color: #66cc66;">&#40;</span>0<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:states<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;{CHECK_UPDATE}&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;152&quot;</span> y=<span style="color: #ff0000;">&quot;86&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Application:&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> x=<span style="color: #ff0000;">&quot;230&quot;</span> y=<span style="color: #ff0000;">&quot;86&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{this._applicationName}&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;19&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Check for updates&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateTitle&quot;</span> <span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;50&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Allow the application to check for updates?&quot;</span> &nbsp;styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;height&quot;</span> value=<span style="color: #ff0000;">&quot;180&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:State<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;{UPDATE_AVAILABLE}&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;height&quot;</span> value=<span style="color: #ff0000;">&quot;360&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> &nbsp;<span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{this._installedVersion}&quot;</span> x=<span style="color: #ff0000;">&quot;230&quot;</span> y=<span style="color: #ff0000;">&quot;114&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> &nbsp;<span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{this._updateVersion}&quot;</span> x=<span style="color: #ff0000;">&quot;230&quot;</span> y=<span style="color: #ff0000;">&quot;134&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;118&quot;</span> y=<span style="color: #ff0000;">&quot;114&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Installed Version:&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;127&quot;</span> y=<span style="color: #ff0000;">&quot;134&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Update Version:&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;152&quot;</span> y=<span style="color: #ff0000;">&quot;96&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Application:&quot;</span> &nbsp;styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> x=<span style="color: #ff0000;">&quot;230&quot;</span> y=<span style="color: #ff0000;">&quot;96&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{this._applicationName}&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;19&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Update Available&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateTitle&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;50&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;An updated version of the application is available for download.&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label id=<span style="color: #ff0000;">&quot;releaseLabel&quot;</span> x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;222&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Release notes&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:TextArea <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{_updateDescription}&quot;</span> x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;248&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;508&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogTextArea&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:HRule x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;214&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;508&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogHRule&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{cancelButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;y&quot;</span> value=<span style="color: #ff0000;">&quot;164&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{continueButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;y&quot;</span> value=<span style="color: #ff0000;">&quot;164&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{cancelButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;label&quot;</span> value=<span style="color: #ff0000;">&quot;Download later&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{continueButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;x&quot;</span> value=<span style="color: #ff0000;">&quot;269&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{continueButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;label&quot;</span> value=<span style="color: #ff0000;">&quot;Download now&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:State<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;{NO_UPDATE}&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;122&quot;</span> y=<span style="color: #ff0000;">&quot;86&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Application:&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> x=<span style="color: #ff0000;">&quot;200&quot;</span> y=<span style="color: #ff0000;">&quot;86&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{this._applicationName}&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;19&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;No Updates&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateTitle&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;50&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;There is no application update available at this time.&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:RemoveChild <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{continueButton}&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{cancelButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;label&quot;</span> value=<span style="color: #ff0000;">&quot;Close&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;height&quot;</span> value=<span style="color: #ff0000;">&quot;180&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:State<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;{UPDATE_DOWNLOADING}&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:ProgressBar x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;84&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;411&quot;</span> label=<span style="color: #ff0000;">&quot; &quot;</span> id=<span style="color: #ff0000;">&quot;progressBar&quot;</span> mode=<span style="color: #ff0000;">&quot;manual&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;15&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDiallogProgress&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Downloading Update&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateTitle&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:RemoveChild <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{continueButton}&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;53&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Download progress...&quot;</span> &nbsp;styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;height&quot;</span> value=<span style="color: #ff0000;">&quot;180&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:State<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;{UPDATE_ERROR}&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;19&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Unexpected error&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateTitle&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;50&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{_errorText}&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:RemoveChild <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{continueButton}&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{cancelButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;label&quot;</span> value=<span style="color: #ff0000;">&quot;Close&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;height&quot;</span> value=<span style="color: #ff0000;">&quot;180&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:State<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;{INSTALL_UPDATE}&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> &nbsp;<span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{this._installedVersion}&quot;</span> x=<span style="color: #ff0000;">&quot;230&quot;</span> y=<span style="color: #ff0000;">&quot;139&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> &nbsp;<span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{this._updateVersion}&quot;</span> x=<span style="color: #ff0000;">&quot;230&quot;</span> y=<span style="color: #ff0000;">&quot;159&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;118&quot;</span> y=<span style="color: #ff0000;">&quot;139&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Installed Version:&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;127&quot;</span> y=<span style="color: #ff0000;">&quot;159&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Update Version:&quot;</span> &nbsp;styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;152&quot;</span> y=<span style="color: #ff0000;">&quot;121&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Application:&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> x=<span style="color: #ff0000;">&quot;230&quot;</span> y=<span style="color: #ff0000;">&quot;121&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{this._applicationName}&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;19&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Install update&quot;</span> id=<span style="color: #ff0000;">&quot;windowTitle4&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateTitle&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;50&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;The update for the application is downloaded and ready to be installed.&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogText&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;262&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Release notes&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogLabel&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:TextArea id=<span style="color: #ff0000;">&quot;relaeseNotesTextArea0&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{_updateDescription}&quot;</span> x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;288&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;508&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogTextArea&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;height&quot;</span> value=<span style="color: #ff0000;">&quot;402&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:ProgressBar id=<span style="color: #ff0000;">&quot;installProgressBar&quot;</span> x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;84&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;411&quot;</span> label=<span style="color: #ff0000;">&quot; &quot;</span> mode=<span style="color: #ff0000;">&quot;manual&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;15&quot;</span> styleName=<span style="color: #ff0000;">&quot;installDiallogProgress&quot;</span> creationComplete=<span style="color: #ff0000;">&quot;installProgressBar.setProgress(100,100)&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AddChild <span style="color: #0066CC;">position</span>=<span style="color: #ff0000;">&quot;lastChild&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:HRule x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;249&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;508&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogHRule&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:AddChild<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{cancelButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;label&quot;</span> value=<span style="color: #ff0000;">&quot;Postpone until restart&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{cancelButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;y&quot;</span> value=<span style="color: #ff0000;">&quot;198&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{continueButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;y&quot;</span> value=<span style="color: #ff0000;">&quot;198&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{continueButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;x&quot;</span> value=<span style="color: #ff0000;">&quot;320&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">SetProperty</span> <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{continueButton}&quot;</span> <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;label&quot;</span> value=<span style="color: #ff0000;">&quot;Install update&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:State<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:states<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> x=<span style="color: #ff0000;">&quot;107&quot;</span> y=<span style="color: #ff0000;">&quot;129&quot;</span> label=<span style="color: #ff0000;">&quot;Cancel&quot;</span> id=<span style="color: #ff0000;">&quot;cancelButton&quot;</span> click=<span style="color: #ff0000;">&quot;cancelUpdate()&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;34&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogButton&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> x=<span style="color: #ff0000;">&quot;202&quot;</span> y=<span style="color: #ff0000;">&quot;129&quot;</span> label=<span style="color: #ff0000;">&quot;Check for Updates&quot;</span> id=<span style="color: #ff0000;">&quot;continueButton&quot;</span> click=<span style="color: #ff0000;">&quot;continueUpdate()&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;34&quot;</span> styleName=<span style="color: #ff0000;">&quot;updateDialogButton&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Image source=<span style="color: #ff0000;">&quot;@Embed('/assets/images/UpdateIcon.png')&quot;</span> x=<span style="color: #ff0000;">&quot;15&quot;</span> y=<span style="color: #ff0000;">&quot;25&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;81&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;74&quot;</span> id=<span style="color: #ff0000;">&quot;iconImage&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
<br />
<span style="color: #66cc66;">&lt;/</span>mx:Window<span style="color: #66cc66;">&gt;</span></div></td></tr></tbody></table></div>
<p><strong>Main.mxml</strong></p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><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><br />
<span style="color: #66cc66;">&lt;</span>mx:WindowedApplication xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> <br />
&nbsp; &nbsp; layout=<span style="color: #ff0000;">&quot;vertical&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;428&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;280&quot;</span> creationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span><span style="color: #66cc66;">&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Style source=<span style="color: #ff0000;">&quot;assets/styles.css&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">thanksmister</span>.<span style="color: #006600;">UpdateManager</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">ResultEvent</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> updater:UpdateManager;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> baseURL:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span> <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> updates:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; configService.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleResult<span style="color: #66cc66;">&#40;</span>event:ResultEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">xml</span>:<span style="color: #0066CC;">XML</span> = event.<span style="color: #006600;">result</span> as <span style="color: #0066CC;">XML</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; baseURL = <span style="color: #0066CC;">xml</span>..<span style="color: #006600;">baseurl</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updates = <span style="color: #0066CC;">xml</span>..<span style="color: #006600;">updates</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>updates<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updater = <span style="color: #000000; font-weight: bold;">new</span> UpdateManager<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:HTTPService id=<span style="color: #ff0000;">&quot;configService&quot;</span> method=<span style="color: #ff0000;">&quot;GET&quot;</span> resultFormat=<span style="color: #ff0000;">&quot;e4x&quot;</span> <span style="color: #0066CC;">url</span>=<span style="color: #ff0000;">&quot;config/configuration.xml&quot;</span> result=<span style="color: #ff0000;">&quot;handleResult(event)&quot;</span> <span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> fontSize=<span style="color: #ff0000;">&quot;14&quot;</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;0xFFFFFFF&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Update tester. &nbsp;Please click the button below to begin update checking or wait for the dealy time (3 min). Once the application is successfully updated, the application version will be updated from v1 to v2.&quot;</span> x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;342&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;104&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> label=<span style="color: #ff0000;">&quot;Begin update process&quot;</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;0xFFFFFFF&quot;</span> &nbsp;x=<span style="color: #ff0000;">&quot;125&quot;</span> y=<span style="color: #ff0000;">&quot;104&quot;</span> click=<span style="color: #ff0000;">&quot;updater.checkNow()&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label id=<span style="color: #ff0000;">&quot;versionText&quot;</span> fontSize=<span style="color: #ff0000;">&quot;14&quot;</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;0xFFFFFFF&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{'Base URL: ' + baseURL}&quot;</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;0xFFFFFFF&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{'Updates: ' + updates}&quot;</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;0xFFFFFFF&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
<span style="color: #66cc66;">&lt;/</span>mx:WindowedApplication<span style="color: #66cc66;">&gt;</span></div></td></tr></tbody></table></div>
<p>I packed up the Flex project.  You would use this basically the same as you would use the ApplicationUpdaterUI framework.  You need to create an update version of your AIR file and place it and update.xm file on a server.    You can test it from the local IDE if you replace the server url with &#8220;app:/&#8221;.  Just remember you can not actually update an AIR application from the IDE, it has to be installed and running on your machine to update, and the update files have to be accessible just like when you use the ApplicationUpdaterUI.</p>
<p>The code is free to use, hose, rip apart, just post back any fixes or enhancements you make.</p>
<p><strong>Source Files</strong></p>
<p><a href="http://www.thanksmister.com/examples/updatetester/UpdateTester.zip">UpdateTester.zip</a></p>
<p><strong>Update</strong></p>
<p>Don&#8217;t forget to add a closing event handler to the dialog box that calls the destory() function.  This was not in the original code and there needs to be a way to handle users clicking on the close box of the Window for the update dialog user interface.  I also added a change that if you don&#8217;t want to show the check for update now option, the &#8220;no update available&#8221; dialog does not appear either, here is the updated code for statusUpdate function in UpdateManager.as (not in the downloaded zip):</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> statusUpdate<span style="color: #66cc66;">&#40;</span>event:StatusUpdateEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//trace(&quot;statusUpdate&quot;);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;event.<span style="color: #006600;">preventDefault</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">available</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">description</span> = getUpdateDescription<span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">details</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">upateVersion</span> = event.<span style="color: #0066CC;">version</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>showCheckState<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createDialog<span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">UPDATE_AVAILABLE</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>updaterDialog<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">applicationName</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">applicationName</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">installedVersion</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">installedVersion</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">upateVersion</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">upateVersion</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">description</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">description</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updaterDialog.<span style="color: #006600;">updateState</span> = UpdaterDialog.<span style="color: #006600;">UPDATE_AVAILABLE</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>showCheckState<span style="color: #66cc66;">&#41;</span> createDialog<span style="color: #66cc66;">&#40;</span>UpdaterDialog.<span style="color: #006600;">NO_UPDATE</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p>-Mister</p>
<p><map name='google_ad_map_710_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/710?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_710_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=710&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fcustom-air-updater-interface-using-applicationupdater%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/custom-air-updater-interface-using-applicationupdater/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Adobe MAX 2009 &#8211; Los Angeles</title>
		<link>http://www.thanksmister.com/index.php/archive/maxwidget/</link>
		<comments>http://www.thanksmister.com/index.php/archive/maxwidget/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 16:00:30 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex News]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Adobe MAX]]></category>
		<category><![CDATA[Adobe Max 2009]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=672</guid>
		<description><![CDATA[This year Adobe Max 2009 is in my own backyard, well sort of 6 miles up the street, which means about an hour away in LA traffic. I am hoping to get in for free some how, either through Adobe Max Awards or by posting the Adobe Max Widget. See everyone there, maybe&#8230;]]></description>
			<content:encoded><![CDATA[<p>This year Adobe Max 2009 is in my own backyard, well sort of 6 miles up the street, which means about an hour away in LA traffic.  I am hoping to get in for free some how, either through Adobe Max Awards or by posting the Adobe Max Widget.  See everyone there, maybe&#8230;</p>
<p><img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bHQ9MTI1MDg3MzA5NzEyMSZwdD*xMjUwODczMTI5MTc3JnA9Nzc*MzcxJmQ9bWF4MDl3aWRnZXQmbj13b3JkcHJlc3MmZz*yJm89ZjVmMmY5YTk*YmY*NGVkNDg4NmNhODMyOWM5NGFiZTYmb2Y9MA==.gif" /><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="MaxWidget" width="400" height="400" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="http://max.adobe.com/widget/test/MaxWidget.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#869ca7" /><param name="allowScriptAccess" value="sameDomain" /><embed src="http://max.adobe.com/widget/MaxWidget.swf" quality="high" bgcolor="#869ca7" width="400" height="400" name="MaxWidget" align="middle" play="true" loop="false" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="crtr=1&#038;gig_lt=1250873097121&#038;gig_pt=1250873129177&#038;gig_g=2&#038;gig_n=wordpress"></embed><param name="FlashVars" value="crtr=1&#038;gig_lt=1250873097121&#038;gig_pt=1250873129177&#038;gig_g=2&#038;gig_n=wordpress" /></object></p>
<p><map name='google_ad_map_672_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/672?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_672_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=672&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fmaxwidget%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/maxwidget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AIR:: Adding Application Menu Bar Items</title>
		<link>http://www.thanksmister.com/index.php/archive/air-adding-application-menu-bar-items/</link>
		<comments>http://www.thanksmister.com/index.php/archive/air-adding-application-menu-bar-items/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 18:55:57 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[garbage collection]]></category>
		<category><![CDATA[NativeApplication]]></category>
		<category><![CDATA[NativeMenuItem]]></category>
		<category><![CDATA[WindowedApplication]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=669</guid>
		<description><![CDATA[Just a quick how-to post on adding application menu bar items to your Adobe AIR application when running. Certain operating systems can support application menu bars, so this example will not be true for all systems. You can check this using &#8220;NativeApplication.supportsMenu == true&#8221;, which basically means you are on Mac OSX dude. If you [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick how-to post on adding application menu bar items to your Adobe AIR application when running.  Certain operating systems can support application menu bars, so this example will not be true for all systems.  You can check this using &#8220;NativeApplication.supportsMenu == true&#8221;, which basically means you are on Mac OSX dude.  If you were on a Windows or Linux box you would check for &#8220;NativeWindow.supportsMenu == true&#8221; and add the menu items to the NativeWindow rather than the NativeApplication.    </p>
<p>As it turns out, I ran into just a small confusing snag that initially prevented the added application menu bar item from firing a select event.   I eventually reached out to the <a href="http://groups.google.com/group/air-tight/browse_thread/thread/a719522bdb10b7a6?hl=en">Adobe AIR Tight</a> discussion group and Jesse Warden had a quick fix.   It turns out that if you do not use strong item references, they are swept away by Garbage Collection (GC) before you actually use the items.    For example instead of creating the <a href="http://">NativeMenuItem</a> within the scope of the function, I had to create it within the scope of the class or in this case, the WindowedApplication.     </p>
<p>In my application I only needed to add a single menu bar item.   So instead of blowing away the entire application menu and then creating all my own menu items (<a href="http://livedocs.adobe.com/flex/3/html/help.html?content=Menus_9.html">as many of the examples show</a>). I just wanted to add a single item to the exiting application menu bar.   On  Mac OS, you get 4 application menu items: YourAppName, File, Edit, and Window.  YourAppName would be your applications name or if you are running in the Eclipse IDE, just simply &#8220;adl&#8221;.  In my case I wanted to add a &#8220;Preferences&#8221; option under the YourAppName.    You can do this by accessing the NativeMenuItem representing the YourAppName. Something like NativeApplication.nativeApplication.menu.items[0] will return a NativeMenuItem with that reference.   Using that reference you can then add a new NativeMenuItem to the submenu of the referenced NativeMenuItem.   In addition to adding items to the submenu, you can also detect when the new item is selected.    </p>
<p>In any event, here is the complete application code example:</p>
<p><span id="more-669"></span></p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><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><br />
<span style="color: #66cc66;">&lt;</span>mx:WindowedApplication xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> windowComplete=<span style="color: #ff0000;">&quot;createApplicationMenu()&quot;</span> &nbsp;<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Style source=<span style="color: #ff0000;">&quot;assets/css/whitelabel.css&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> prefItem:NativeMenuItem;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> menuItem:NativeMenuItem;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createApplicationMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>NativeApplication.<span style="color: #006600;">supportsMenu</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prefItem = <span style="color: #000000; font-weight: bold;">new</span> NativeMenuItem<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Preferences...&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prefItem.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">SELECT</span>, handlePreferencesSelected<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prefItem.<span style="color: #006600;">keyEquivalent</span> = <span style="color: #ff0000;">&quot;,&quot;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menuItem = NativeMenuItem<span style="color: #66cc66;">&#40;</span>NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #0066CC;">menu</span>.<span style="color: #006600;">items</span><span style="color: #66cc66;">&#91;</span>0<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menuItem.<span style="color: #006600;">submenu</span>.<span style="color: #006600;">addItemAt</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> NativeMenuItem<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;&quot;</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>, 1<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menuItem.<span style="color: #006600;">submenu</span>.<span style="color: #006600;">addItemAt</span><span style="color: #66cc66;">&#40;</span>prefItem, 2<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handlePreferencesSelected<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;handlePreferencesSelected&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
<span style="color: #66cc66;">&lt;/</span>mx:WindowedApplication<span style="color: #66cc66;">&gt;</span></div></td></tr></tbody></table></div>
<p>That&#8217;s it, so now you can have a new item under your application name in the application menu bar to fire whatever function you desire.   </p>
<p>-Mister</p>
<p><map name='google_ad_map_669_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/669?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_669_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=669&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fair-adding-application-menu-bar-items%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/air-adding-application-menu-bar-items/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>AIR :: TextField bug when resetting HTML text.</title>
		<link>http://www.thanksmister.com/index.php/archive/air-textfield-bug-when-resetting-html-text/</link>
		<comments>http://www.thanksmister.com/index.php/archive/air-textfield-bug-when-resetting-html-text/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 17:29:06 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=625</guid>
		<description><![CDATA[I ran into a really strange issue that only occurs within AIR applications (AIR 1.5.1/1.5.2).   When I create a TextField control, set it's style, and then assign it HTML text it appears fine.  However, if I wish to reset that TextField content and the original content has links, the entire replaced content becomes one HTML link.    I think the issue can be better explained with some images and some code samples. ]]></description>
			<content:encoded><![CDATA[<p>I ran into a really strange issue that only occurs within Adobe AIR applications (<a href="http://get.adobe.com/air/">AIR 1.5.1/1.5.2</a>).   When I create a TextField control, set it&#8217;s style, and then assign it HTML text it appears fine.  However, if I wish to reset that TextField content and the original content has links, the entire replaced content becomes one HTML link.    I think the issue can be better explained with some images and some code samples. </p>
<p><strong>Issue Context</strong></p>
<p>The first image is a TextField with one HTML link.  The link fires a TextEvent which is handled by a function which replaces the text.   The original TextField out put is in the image below withe the &#8220;more&#8221; HTML link at the end:</p>
<p><img alt="" src="http://thanksmister.com/examples/htmltextfield/textfield1.png" title="TextField" class="alignnone" width="432" height="259" /></p>
<p>The second image shows the result when the &#8220;more&#8221; link is clicked and the text is replaced.   You can see that when the mouse is over the text the entire text becomes a &#8220;more&#8221; link even though the new content has no HTML links.   The rollover style on the TextField underlines the text.</p>
<p><img alt="" src="http://thanksmister.com/examples/htmltextfield/textfield2.png" title="TextField" class="alignnone" width="440" height="258" /></p>
<p><span id="more-625"></span></p>
<p>Below is the complete AIR application code that shows how I setup the application and changed the TextField content.</p>
<p><strong>Code</strong></p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><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><br />
<span style="color: #66cc66;">&lt;</span>mx:WindowedApplication xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> applicationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">core</span>.<span style="color: #006600;">UIComponent</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">navigateToURL</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> textMessage:<span style="color: #0066CC;">TextField</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> longtext:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque fermentum lorem in dolor facilisis aliquam dictum libero aliquet. Pellentesque scelerisque eleifend nunc nec consectetur. Pellentesque et libero lacus. Etiam condimentum diam pellentesque quam pretium ut gravida velit rutrum. Pellentesque sapien mauris, semper accumsan tristique at, hendrerit sed nunc. Quisque diam odio, dignissim quis scelerisque eu, interdum sed nibh. Sed fringilla, enim ac ultricies tristique, lacus ligula aliquet neque, et imperdiet nulla tellus in erat. In pulvinar, urna non semper congue, leo nulla vulputate dolor, et congue dui purus ac risus. Duis accumsan scelerisque consectetur. Nulla nisi justo, interdum sed porttitor a, rhoncus at lorem. Suspendisse sit amet tellus est. Maecenas vestibulum tristique sapien eu interdum. Integer a risus odio. &quot;</span> + <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;Vivamus ac placerat neque. Donec consectetur malesuada lectus, id euismod odio convallis sit amet. Integer eget purus vel neque sagittis blandit.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> shorttext:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque fermentum lorem in dolor facilisis aliquam dictum libero aliquet. &lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>event:more<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;[more]&lt;/a&gt;.&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">object</span>:UIComponent = <span style="color: #000000; font-weight: bold;">new</span> UIComponent<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">object</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage.<span style="color: #0066CC;">multiline</span> = <span style="color: #000000; font-weight: bold;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage.<span style="color: #0066CC;">wordWrap</span> = <span style="color: #000000; font-weight: bold;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage.<span style="color: #0066CC;">selectable</span> = <span style="color: #000000; font-weight: bold;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>TextEvent.<span style="color: #006600;">LINK</span>, handleLinkClicked<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">object</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>textMessage<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage.<span style="color: #006600;">styleSheet</span> = getTextStyle<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>body<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> + shorttext + <span style="color: #ff0000;">&quot;&lt;/span&gt;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage.<span style="color: #0066CC;">width</span> = <span style="color: #cc66cc;">400</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage.<span style="color: #0066CC;">height</span> = <span style="color: #cc66cc;">200</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getTextStyle<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> : StyleSheet <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> textStyle:StyleSheet = <span style="color: #000000; font-weight: bold;">new</span> StyleSheet<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> fonts:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;Arial, _sans&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textStyle = <span style="color: #000000; font-weight: bold;">new</span> StyleSheet<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textStyle.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;.body&quot;</span>, <span style="color: #66cc66;">&#123;</span>fontFamily:fonts, fontSize:<span style="color: #ff0000;">&quot;12&quot;</span>, fontWeight:<span style="color: #ff0000;">&quot;normal&quot;</span>, <span style="color: #0066CC;">color</span>:<span style="color: #ff0000;">&quot;#222222&quot;</span>, textDecoration:<span style="color: #ff0000;">&quot;none&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textStyle.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;a&quot;</span>, <span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">color</span>:<span style="color: #ff0000;">&quot;#245290&quot;</span>, textDecoration:<span style="color: #ff0000;">&quot;none&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textStyle.<span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;a:hover&quot;</span>, <span style="color: #66cc66;">&#123;</span> textDecoration: <span style="color: #ff0000;">&quot;underline&quot;</span> <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> textStyle;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleLinkClicked<span style="color: #66cc66;">&#40;</span>event:TextEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> prefix:<span style="color: #0066CC;">String</span> = event.<span style="color: #0066CC;">text</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">split</span>:<span style="color: #0066CC;">Array</span> = prefix.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;:&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">type</span>:<span style="color: #0066CC;">String</span> = <span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#91;</span>0<span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> id:<span style="color: #0066CC;">String</span> = <span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#91;</span>1<span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">split</span>.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&gt;</span> 2<span style="color: #66cc66;">&#41;</span> id = <span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> + <span style="color: #ff0000;">&quot;:&quot;</span> + <span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#91;</span>2<span style="color: #66cc66;">&#93;</span>; <span style="color: #808080; font-style: italic;">// recreate the http link</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">type</span> == <span style="color: #ff0000;">&quot;more&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>body<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> + longtext + <span style="color: #ff0000;">&quot;&lt;/span&gt;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">type</span> == <span style="color: #ff0000;">&quot;link&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> request:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; navigateToURL<span style="color: #66cc66;">&#40;</span>request,<span style="color: #ff0000;">&quot;_blank&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
<span style="color: #66cc66;">&lt;/</span>mx:WindowedApplication<span style="color: #66cc66;">&gt;</span></div></td></tr></tbody></table></div>
<p><strong>Workaround</strong></p>
<p>I can&#8217;t remember where in my web travels or blog reading I found this, but there seems to be a need to reset the TextField.htmlText value before setting the TextField.text value within AIR applications to clear the previous content.  I couldn&#8217;t find any official bug that reported this issue.    However, doing this will eliminate the bug and reset the TextField content properly.  So in the event handler for TextEvent, just before setting the content of the TextField, do the <strong>textMessage.htmlText = &#8220;&#8221;</strong>:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleLinkClicked<span style="color: #66cc66;">&#40;</span>event:TextEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> prefix:<span style="color: #0066CC;">String</span> = event.<span style="color: #0066CC;">text</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">split</span>:<span style="color: #0066CC;">Array</span> = prefix.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;:&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">type</span>:<span style="color: #0066CC;">String</span> = <span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#91;</span>0<span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> id:<span style="color: #0066CC;">String</span> = <span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#91;</span>1<span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">split</span>.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&gt;</span> 2<span style="color: #66cc66;">&#41;</span> id = <span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> + <span style="color: #ff0000;">&quot;:&quot;</span> + <span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#91;</span>2<span style="color: #66cc66;">&#93;</span>; <span style="color: #808080; font-style: italic;">// recreate the http link</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">type</span> == <span style="color: #ff0000;">&quot;more&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage.<span style="color: #0066CC;">htmlText</span> = <span style="color: #ff0000;">&quot;&quot;</span>; &nbsp;<span style="color: #808080; font-style: italic;">// reset the HTML value of the TextField</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textMessage.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>body<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> + longtext + <span style="color: #ff0000;">&quot;&lt;/span&gt;&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">type</span> == <span style="color: #ff0000;">&quot;link&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> request:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; navigateToURL<span style="color: #66cc66;">&#40;</span>request,<span style="color: #ff0000;">&quot;_blank&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p>The issue could be with setting the styles of the link tags of the TextField.  However, I could not reproduce this issue with Flex in a browser, this only occurs within an AIR application.  If anyone can explain why this works or point me to the bug report for this particular issue, please pass it on, thanks!</p>
<p>-Mister</p>
<p><map name='google_ad_map_625_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/625?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_625_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=625&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fair-textfield-bug-when-resetting-html-text%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/air-textfield-bug-when-resetting-html-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using AIR 1.5.1 InovkeReason for friendlier applications</title>
		<link>http://www.thanksmister.com/index.php/archive/using-air-1-5-1-inovkereason-for-friendlier-applications/</link>
		<comments>http://www.thanksmister.com/index.php/archive/using-air-1-5-1-inovkereason-for-friendlier-applications/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 20:07:16 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[InvokeEvent]]></category>
		<category><![CDATA[InvokeEventReason]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=602</guid>
		<description><![CDATA[I recently discovered a new feature of AIR 1.5.1 that makes AIR applications more consumer friendly in certain situations. When you have your application set to start on user login using &#8220;NativeApplication.nativeApplication.startAtLogin = true&#8221;, you may want the application to start as a background process rather than show the entire application at login. In AIR [...]]]></description>
			<content:encoded><![CDATA[<p>I recently <a href="http://blogs.adobe.com/simplicity/2009/02/invokeevent_reason_in_air_1_5_1.html">discovered</a> a new feature of AIR 1.5.1 that makes AIR applications more consumer friendly in certain situations.   When you have your application set to start on user login using &#8220;NativeApplication.nativeApplication.startAtLogin = true&#8221;, you may want the application to start as a background process rather than show the entire application at login.   In AIR 1.5.1 there is a new property of the InvokeEvent called &#8220;reason&#8221; that will report if the application was started at login or was started when the users invokes the application by launching the application.  </p>
<p>By capturing this event and testing for InovokeReason.LOGIN, you can keep your application invisible and only show the windows docked in the system tray.   If a users starts the application it will be InvokeReason.STANDARD and you can then show the application as normal.   I find it annoying to have a ton of windows popping up on my screen when I restart my computer.    </p>
<p>I usually set up an InvokeEvent when a users clicks on the system tray icon to activate the application and bring it to the forefront.   I initially set  WindowsApplicatoin visible=&#8221;false&#8221; so the application is invisible on start.   If the the InvokeEventReason is &#8220;LOGIN&#8221;, I keep the application invisible, in other cases I activate the application and bring it to the forefront.  </p>
<p>It should be noted that the InvokeEvent fires on application start up as well as from running the the application from the IDE (so you can&#8217;t test it fully unless you install the application and login again).  Also, because of timing of events at start up, the application is invisible even when you set it to active, so it will blink if the InvokeEventReason is STANDARD.  To avoid this behavior, I use the &#8220;windowComplete&#8221; event of the WindowedApplication to add the InvokeEvent listeners.    So the code might look something like the following: </p>
<p><span id="more-602"></span></p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><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><br />
<span style="color: #66cc66;">&lt;</span>mx:WindowedApplication xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> &nbsp;windowComplete=<span style="color: #ff0000;">&quot;onAppInit()&quot;</span> &nbsp;<span style="color: #0066CC;">visible</span>=<span style="color: #ff0000;">&quot;false&quot;</span> &nbsp;<span style="color: #66cc66;">&gt;</span><br />
<br />
<span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onAppInit<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>NativeApplication.<span style="color: #006600;">supportsSystemTrayIcon</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// windows</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setSystemTrayProperties<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>NativeApplication.<span style="color: #006600;">supportsDockIcon</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// mac</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setDockProperties<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// add click event to the system tray</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> setSystemTrayProperties<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> sysTray:SystemTrayIcon = NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">icon</span> as SystemTrayIcon;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sysTray.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, onIconClick, <span style="color: #000000; font-weight: bold;">false</span>, 0, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>InvokeEvent.<span style="color: #006600;">INVOKE</span>, onIconClick, <span style="color: #000000; font-weight: bold;">false</span>, 0, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// add click event to the system tray</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> setDockProperties<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>InvokeEvent.<span style="color: #006600;">INVOKE</span>, onIconClick, <span style="color: #000000; font-weight: bold;">false</span>, 0, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onIconClick<span style="color: #66cc66;">&#40;</span>event:InvokeEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;INVOKE REASON: &quot;</span> + event.<span style="color: #006600;">reason</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">reason</span> <span style="color: #66cc66;">!</span>= InvokeEventReason.<span style="color: #006600;">LOGIN</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>NativeApplication.<span style="color: #006600;">supportsSystemTrayIcon</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">nativeWindow</span>.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">true</span>; &nbsp;<span style="color: #808080; font-style: italic;">// win</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">nativeWindow</span>.<span style="color: #006600;">activate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; &nbsp;<span style="color: #808080; font-style: italic;">// mac</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">nativeWindow</span>.<span style="color: #006600;">orderToFront</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span><br />
<span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span></div></td></tr></tbody></table></div>
<p>- Mister</p>
<p><map name='google_ad_map_602_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/602?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_602_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=602&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fusing-air-1-5-1-inovkereason-for-friendlier-applications%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/using-air-1-5-1-inovkereason-for-friendlier-applications/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>AIR :: NativeMenu issue on Mac</title>
		<link>http://www.thanksmister.com/index.php/archive/air-nativemenu-issue-on-mac/</link>
		<comments>http://www.thanksmister.com/index.php/archive/air-nativemenu-issue-on-mac/#comments</comments>
		<pubDate>Wed, 06 May 2009 17:06:42 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[NativeMenu]]></category>
		<category><![CDATA[NativeMenu Item]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=570</guid>
		<description><![CDATA[I think the NativeMenu is a great option for AIR applications as you can get a consistent look for the application that matches the operating system. The other advantage is that NativeMenu&#8217;s are &#8220;outside&#8221; of the application and do not get clipped as they would if you just created a popup Canvas with a List [...]]]></description>
			<content:encoded><![CDATA[<p>I think the NativeMenu is a great option for AIR applications as you can get a consistent look for the application that matches the operating system.  The other advantage is that NativeMenu&#8217;s are &#8220;outside&#8221; of the application and do not get clipped as they would if you just created a popup Canvas with a List control.   However, I could not get the native menu to appear as a popup in my tests.  In fact, it would often result in crashing the AIR application when i did NativeMenu.display();.  </p>
<p>If I call a function that creates a NativeMenu from a button click everything works great.  If I call the same function to create the menu from an event (like receiving data from a service call), the menu is not created and the application crashes upon subsequent attempts to create the menu.   In addition, trying to create a NativeMenu popup on &#8220;createComplete&#8221; of the application also causes a crash. </p>
<p>So let&#8217;s say you have an application that you want to show a NativeMenu as a popup on startup of the application so you run the following:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><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><br />
<span style="color: #66cc66;">&lt;</span>mx:WindowedApplication xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> creationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span> &nbsp;<span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;540&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;388&quot;</span> <span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Style source=<span style="color: #ff0000;">&quot;styles.css&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> nativeMenu:NativeMenu = <span style="color: #000000; font-weight: bold;">new</span> NativeMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> menuItem1:NativeMenuItem = <span style="color: #000000; font-weight: bold;">new</span> NativeMenuItem<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Menu Item 1&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> menuItem2:NativeMenuItem = <span style="color: #000000; font-weight: bold;">new</span> NativeMenuItem<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Menu Item 2&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nativeMenu.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>menuItem1<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nativeMenu.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>menuItem2<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #0066CC;">menu</span>.<span style="color: #006600;">display</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">stage</span>, 100, 100<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
<span style="color: #66cc66;">&lt;/</span>mx:WindowedApplication<span style="color: #66cc66;">&gt;</span></div></td></tr></tbody></table></div>
<p><span id="more-570"></span></p>
<p>This will cause an immediate crash of the application.   But if you create an non-poppup NativeMenu, it works:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><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><br />
<span style="color: #66cc66;">&lt;</span>mx:WindowedApplication xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> creationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span> &nbsp;<span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;540&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;388&quot;</span> <span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Style source=<span style="color: #ff0000;">&quot;styles.css&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> nativeMenu:NativeMenu = <span style="color: #000000; font-weight: bold;">new</span> NativeMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> menuItem1:NativeMenuItem = <span style="color: #000000; font-weight: bold;">new</span> NativeMenuItem<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Menu Item 1&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> menuItem2:NativeMenuItem = <span style="color: #000000; font-weight: bold;">new</span> NativeMenuItem<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Menu Item 2&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nativeMenu.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>menuItem1<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nativeMenu.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>menuItem2<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>NativeApplication.<span style="color: #006600;">supportsMenu</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> menuItem:NativeMenuItem = <span style="color: #000000; font-weight: bold;">new</span> NativeMenuItem<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Menu Name&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; menuItem.<span style="color: #006600;">submenu</span> = nativeMenu;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #0066CC;">menu</span>.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>menuItem<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span><br />
<br />
&nbsp; &nbsp; <br />
<span style="color: #66cc66;">&lt;/</span>mx:WindowedApplication<span style="color: #66cc66;">&gt;</span></div></td></tr></tbody></table></div>
<p>This works just fine.  Initially I assumed this is some kind of timing issue or a possible undocumented bug.  After a ton of research and much wasted time, I did find a possible bug mentioned by Marco Casario in his book &#8220;The Essential Guide to Flash CS4 AIR Development book is oriented to Flash developers &#8220;.  Here is a snippet from his chapter on creating NatveMenu&#8217;s:</p>
<blockquote><p>The display() method of the NativeMenu class only works properly on Microsoft Windows systems. Flash Player doesn’t work properly on Mac OS X systems, and displays the pop- up menu on the cursor of the mouse instead of at the specified coordinates. This occurs if the call to the display() function happens as a consequence of an event of the MouseEvent class . If the call happens in response to other events, the application doesn’t display the pop- up menu at all.</p></blockquote>
<p>This limitation was not mentioned in the Adobe Documentation and as it happens, I was trying to create a NativeMenu popup for my AIR application on a Mac.   I hate when you find these things out the hard way and waste a bunch of time tracking down obscure undocumented issues.    If this is a limitation, it should clearly be presented as such when you look at the examples in the Adobe help.    I think this is a Flash player on Mac issue, but so far I can&#8217;t find any official documentation on the problem nor could I track down an actual bug report.   If anyone has any suggestions, please pass them on, thanks!</p>
<p>-Mr</p>
<p><map name='google_ad_map_570_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/570?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_570_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=570&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fair-nativemenu-issue-on-mac%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/air-nativemenu-issue-on-mac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adobe AIR Runtime Font Differences</title>
		<link>http://www.thanksmister.com/index.php/archive/adobe-air-runtime-font-differences/</link>
		<comments>http://www.thanksmister.com/index.php/archive/adobe-air-runtime-font-differences/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 02:18:27 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Font]]></category>
		<category><![CDATA[Flex Builder 3]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=355</guid>
		<description><![CDATA[This was a heck of a problem to discover and even worse to try to figure out why. Sadly, I did not find a good solution the problem. I will give the short and sweet rundown of the issue. You have three different machines, three different operating system, the same version of Flex Builder (3.0.2), [...]]]></description>
			<content:encoded><![CDATA[<p>This was a heck of a problem to discover and even worse to try to figure out why. Sadly, I did not find a good solution the problem.  I will give the short and sweet rundown of the issue.  You have three different machines, three different operating system, the same version of Flex Builder (3.0.2), and the same code base.   Now you would think that when you create a release version of an AIR application on one machine, then deploy it on another, you would get consistent results.   However, we experienced that an AIR file created one Windows environment was different from the AIR file created on another Windows environment and a Mac machine.   The difference was visible with the fonts displayed in the application.</p>
<p>I have to be clear about this part, because first you might think that the fonts are rendered differently on each machine because we didn&#8217;t embed the font within the application.  So you would see different fonts on a Mac or from one PC to another.  That would be a good guess, but you would be wrong.  I have running on my Mac three copies of our AIR application (app_1.air, app_2.air, app_3.air), running side-by-side at the same time on the same screen. All three applications compiled form the same exact code base, but from different machines (two PC&#8217;s and one Mac).   </p>
<p><span id="more-355"></span></p>
<p>One version of the application shows clearly readable fonts, the others two applicaions show thinner more jaggy fonts with some color differences.   The most significant differences are displayed with italic text and text on fonts.  I couldn&#8217;t believe it myself, but I have a screen shot to prove it.  Below you can see all three  applications.  The screen shot was taken of the applications side-by-side and then changed in Photoshop for better display on the blog page (vertical instead of horizontal).  You will notice that one has better looking text, thicker, richer colors, and just more readable. The other two are <del datetime="2009-02-07T21:33:44+00:00">crap</del>, well, not as readable, especially the button text and the italic text. </p>
<p><strong>Image</strong></p>
<p><img alt="" src="http://farm4.static.flickr.com/3345/3258727225_19c4a9d427_o.png" title="Font Issue AIR" class="alignnone" width="660" height="430" /></p>
<p>The middle application clearly has the best displayed fonts, even though they are all running on the same exact machine, there is noticeable display differences. The only difference is the machine that compiled each AIR file.  The font on the tabs is thicker for the middle one, the button fonts are clearer and thicker for the middle one, and the italic font is more readable.    I don&#8217;t know how to fix this issue, embedding fonts did not work, installing the same fonts on each machine didn&#8217;t work, nothing helped!  Why do some machines produce a better quality AIR file while others produce jaggy text?   I couldn&#8217;t find any information on this problem, so please let me know if anyone has any solution.</p>
<p><strong>UPDATE</strong></p>
<p>If you run your AIR package on a Windows machine with &#8220;clear type&#8221; turned on, then it actually produces better fonts.  This makes all three applications look identical on a PC, but with clear type off, then only one of the applications looks good.   The application generated on the Mac, and generated on the PC with clear Type on, still look the degraded when compared to the middle application.</p>
<p>The best solution I could find to have a consistent look for the AIR application when created from different computers is to embed fonts within the application.  Still does not solve the reason why there was a difference, but it does offer a temporary solution.  For more information on embedding fonts check out <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_05.html">Adobe docs on the topic</a>.</p>
<p>- Mister</p>
<p><map name='google_ad_map_355_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/355?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_355_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=355&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fadobe-air-runtime-font-differences%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/adobe-air-runtime-font-differences/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Storing an ArrayCollection in the EncryptedLocalStore</title>
		<link>http://www.thanksmister.com/index.php/archive/storing-arraycollection-in-encryptedlocalstore/</link>
		<comments>http://www.thanksmister.com/index.php/archive/storing-arraycollection-in-encryptedlocalstore/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 00:47:08 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Adobe Integrated Runtime]]></category>
		<category><![CDATA[ArrayCollection]]></category>
		<category><![CDATA[describeType]]></category>
		<category><![CDATA[EncryptedLocalStore]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=213</guid>
		<description><![CDATA[On one of my side AIR projects I got the idea to store an ArrayCollection (AC) object into the EncryptedLocalStore (ELS) to have a sort of mini data structure. I thought it would be no problem since you can basically throw anything you want into the EncryptedLocalStore as long as its not over 10MB where [...]]]></description>
			<content:encoded><![CDATA[<p>On one of my side AIR projects I got the idea to store an ArrayCollection (AC) object into the EncryptedLocalStore (ELS) to have a sort of mini data structure.   I thought it would be no problem since you can basically throw anything you want into the EncryptedLocalStore as long as its not over 10MB where performance would be hampered.   I built a little sample script to test the idea by filling an AC with a bunch of value objects.   Upon retrieving the AC from the ELS, I cast it as an AC, but none of the value objects were readable.  I tried casting the value objects, but that threw a runtime error in Flex.    </p>
<p>I did some searching around and found <a href="http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&amp;postid=10563&amp;loc=en_US&amp;productid=4">one example</a> from the <a href="http://www.adobe.com/products/air/" title="Adobe Integrated Runtime" rel="homepage" class="zem_slink">Adobe AIR</a> cookbook that stores and retrieves an value object from the ELS, casting the object as a value object when retrieved.  However, I really wanted to store a whole AC of value objects and retrieve them.    So I did a little more searching and found one blog post that outlines the same issue I was having: <a href="http://corlan.org/2008/07/29/how-to-create-a-generic-function-for-parsing-an-xml-into-an-array-collection-of-objects-of-a-certain-type/">&#8220;when I read the object from disk back into my application, the type of objects from Array Collection is lost.&#8221;</a> </p>
<p>Ok, cool, so the blog post lists a generic function to solve the solution by transforming the objects stored in the AC back to a proper value object.  I wanted to make a little demo that combines the AIR cookbook example with the solution for storing/retrieving AC from the ELS with a slight modification of the generic function. </p>
<p><span id="more-213"></span></p>
<p>The first step is to create our Contact value object similar to the cookbook example:</p>
<p>Contact.as</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">package com.<span style="color: #006600;">thanksmister</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Contact<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> firstName:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> lastName:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> phoneNumber:<span style="color: #0066CC;">String</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Contact<span style="color: #66cc66;">&#40;</span>firstName:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span>, lastName:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span>, phoneNumber:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">firstName</span> = firstName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">lastName</span> = lastName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">phoneNumber</span> = phoneNumber;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p>Now we create a function that creates an ArrayCollection of Contact value objects and stores those in the EncryptedLocalStore:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> storeContacts<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> contact:Contact = <span style="color: #000000; font-weight: bold;">new</span> Contact<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;Michael&quot;</span>, <span style="color: #ff0000;">&quot;Ritchie&quot;</span>, <span style="color: #ff0000;">&quot;555-555-5555&quot;</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> ac:ArrayCollection = <span style="color: #000000; font-weight: bold;">new</span> ArrayCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ac.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>contact<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> bytes:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bytes.<span style="color: #006600;">writeObject</span><span style="color: #66cc66;">&#40;</span> ac <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; EncryptedLocalStore.<span style="color: #006600;">setItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;contacts&quot;</span>, bytes <span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p>Ok, now we have stored out ArrayCollection of Contact VO&#8217;s in the EncryptedLocalStore, now we need to write a function that retrieves the AC and transforms all of the VO&#8217;s back to something that we can utilize within Flex:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> retrieveContacts<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// retrieve AC from ELS</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> bytes:ByteArray = EncryptedLocalStore.<span style="color: #006600;">getItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;contacts&quot;</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> collection:ArrayCollection = bytes.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as ArrayCollection;<br />
&nbsp; &nbsp; &nbsp;collection = serializeContacts<span style="color: #66cc66;">&#40;</span>Contact, collection<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// trace our collection value</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>Contact<span style="color: #66cc66;">&#40;</span>collection.<span style="color: #006600;">getItemAt</span><span style="color: #66cc66;">&#40;</span>0<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">firstName</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> serializeContacts<span style="color: #66cc66;">&#40;</span>valueObject:<span style="color: #000000; font-weight: bold;">Class</span>, arryCollection:ArrayCollection<span style="color: #66cc66;">&#41;</span>:ArrayCollection<br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// use the the flash.utils.describeType to create an XML of the property names within the object</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">xml</span>:<span style="color: #0066CC;">XML</span> = describeType<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> valueObject<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> properties:XMLList = <span style="color: #0066CC;">xml</span>..<span style="color: #006600;">accessor</span>.<span style="color: #66cc66;">@</span><span style="color: #0066CC;">name</span>;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> tempac:ArrayCollection = <span style="color: #000000; font-weight: bold;">new</span> ArrayCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// iterate through the collection passed into the function and reassign the types to it's objects</span><br />
&nbsp; &nbsp; &nbsp;<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> <span style="color: #0066CC;">object</span>:<span style="color: #0066CC;">Object</span> <span style="color: #b1b100;">in</span> arryCollection<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> tempvo:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> valueObject<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<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> <span style="color: #0066CC;">name</span>:<span style="color: #0066CC;">Object</span> <span style="color: #b1b100;">in</span> properties<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempvo<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0066CC;">object</span><span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;tempac.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>tempvo<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//add the item to collection</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// return an ArrayCollection of the Class file passed into the function</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">return</span> tempac;<br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p>The above serializeContacts function takes a Class file (VO) and an ArrayCollection pulled from the EncryptedLocalStore using the retrieveContacts function.  The VO is our Contact VO that we want to use to transform our ArrayCollection of objects. This generic function is pretty much what Mihai Corlan used on his blog post, but I changed&#8221; xml..value.@name;&#8221; from the example he posted to &#8220;xml..accessor.@name;&#8221; in my example in this post because the dump using the describeType() utility method the node we want is &#8220;accessor&#8221;.   (The describeType() method returns an xml dump of the details about the object that is passed into the method.  This is a pretty cool function that I previously didn&#8217;t know about.)  Here is the dump of our Contact value object when I trace out the &#8220;xml&#8221; value from the above serializeContacts function:</p>
<p>xml:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&lt;</span>type <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;com.thanksmister::Contact&quot;</span> base=<span style="color: #ff0000;">&quot;Object&quot;</span> isdynamic=<span style="color: #ff0000;">&quot;false&quot;</span> isfinal=<span style="color: #ff0000;">&quot;false&quot;</span> isstatic=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;</span>extendsclass <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;Object&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;</span>implementsinterface <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;flash.events::IEventDispatcher&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;</span>constructor<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;String&quot;</span> optional=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;String&quot;</span> optional=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;String&quot;</span> optional=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;/</span>parameter<span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;</span>accessor <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;lastName&quot;</span> access=<span style="color: #ff0000;">&quot;readwrite&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;String&quot;</span> declaredby=<span style="color: #ff0000;">&quot;com.thanksmister::Contact&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>metadata <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;Bindable&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>arg <span style="color: #0066CC;">key</span>=<span style="color: #ff0000;">&quot;event&quot;</span> value=<span style="color: #ff0000;">&quot;propertyChange&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>arg<span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;/</span>metadata<span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;</span>method <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;dispatchEvent&quot;</span> declaredby=<span style="color: #ff0000;">&quot;com.thanksmister::Contact&quot;</span> returntype=<span style="color: #ff0000;">&quot;Boolean&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;flash.events::Event&quot;</span> optional=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;/</span>parameter<span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;</span>method <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;hasEventListener&quot;</span> declaredby=<span style="color: #ff0000;">&quot;com.thanksmister::Contact&quot;</span> returntype=<span style="color: #ff0000;">&quot;Boolean&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;String&quot;</span> optional=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;/</span>parameter<span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;</span>accessor <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;phoneNumber&quot;</span> access=<span style="color: #ff0000;">&quot;readwrite&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;String&quot;</span> declaredby=<span style="color: #ff0000;">&quot;com.thanksmister::Contact&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>metadata <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;Bindable&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>arg <span style="color: #0066CC;">key</span>=<span style="color: #ff0000;">&quot;event&quot;</span> value=<span style="color: #ff0000;">&quot;propertyChange&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>arg<span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;/</span>metadata<span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;</span>method <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;willTrigger&quot;</span> declaredby=<span style="color: #ff0000;">&quot;com.thanksmister::Contact&quot;</span> returntype=<span style="color: #ff0000;">&quot;Boolean&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;String&quot;</span> optional=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;/</span>parameter<span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;</span>method <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;removeEventListener&quot;</span> declaredby=<span style="color: #ff0000;">&quot;com.thanksmister::Contact&quot;</span> returntype=<span style="color: #ff0000;">&quot;void&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;String&quot;</span> optional=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;Function&quot;</span> optional=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;Boolean&quot;</span> optional=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;/</span>parameter<span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;</span>accessor <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;firstName&quot;</span> access=<span style="color: #ff0000;">&quot;readwrite&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;String&quot;</span> declaredby=<span style="color: #ff0000;">&quot;com.thanksmister::Contact&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>metadata <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;Bindable&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>arg <span style="color: #0066CC;">key</span>=<span style="color: #ff0000;">&quot;event&quot;</span> value=<span style="color: #ff0000;">&quot;propertyChange&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>arg<span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;/</span>metadata<span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;</span>method <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;addEventListener&quot;</span> declaredby=<span style="color: #ff0000;">&quot;com.thanksmister::Contact&quot;</span> returntype=<span style="color: #ff0000;">&quot;void&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;String&quot;</span> optional=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;Function&quot;</span> optional=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;Boolean&quot;</span> optional=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;int&quot;</span> optional=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>parameter <span style="color: #0066CC;">index</span>=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;Boolean&quot;</span> optional=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; <span style="color: #66cc66;">&lt;/</span>parameter<span style="color: #66cc66;">&gt;</span><br />
<span style="color: #66cc66;">&lt;/</span>parameter<span style="color: #66cc66;">&gt;</span></div></td></tr></tbody></table></div>
<p>We are interested in the name property of accessor node, and we store those names in an XMLList called &#8220;properties&#8221;.  This XMLList will be used later to assign the values of the Contact properties within the serializeContacts function.    So this gives us a legitimate Contact value objects stored in the ArrayCollection, which we can then use in our application without any errors or null values. </p>
<p>Here is the complete sample application code that can be copied and used in an AIR application:</p>
<p>Main.mxml:</p>
<div class="codecolorer-container actionscript mac-classic" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:640px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br /></div></td><td><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&lt;</span>mx:windowedapplication xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;435&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;277&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:script<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span>--<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">collections</span>.<span style="color: #006600;">ArrayCollection</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">thanksmister</span>.<span style="color: #006600;">Contact</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">describeType</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">ByteArray</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> storeContacts<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> contact:Contact = <span style="color: #000000; font-weight: bold;">new</span> Contact<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;Michael&quot;</span>, <span style="color: #ff0000;">&quot;Ritchie&quot;</span>, <span style="color: #ff0000;">&quot;555-555-5555&quot;</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> ac:ArrayCollection = <span style="color: #000000; font-weight: bold;">new</span> ArrayCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ac.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>contact<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> bytes:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> ByteArray<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bytes.<span style="color: #006600;">writeObject</span><span style="color: #66cc66;">&#40;</span> ac <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EncryptedLocalStore.<span style="color: #006600;">setItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;contacts&quot;</span>, bytes <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outPutText.<span style="color: #0066CC;">text</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Contact Stored<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> retrieveContacts<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// retrieve AC from ELS</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> bytes:ByteArray = EncryptedLocalStore.<span style="color: #006600;">getItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;contacts&quot;</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> collection:ArrayCollection = bytes.<span style="color: #006600;">readObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> as ArrayCollection;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collection = serializeContacts<span style="color: #66cc66;">&#40;</span>Contact, collection<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// trace our collection value</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outPutText.<span style="color: #0066CC;">text</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;First Name: &quot;</span> + Contact<span style="color: #66cc66;">&#40;</span>collection.<span style="color: #006600;">getItemAt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">firstName</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outPutText.<span style="color: #0066CC;">text</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Last Name: &quot;</span> + Contact<span style="color: #66cc66;">&#40;</span>collection.<span style="color: #006600;">getItemAt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">lastName</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outPutText.<span style="color: #0066CC;">text</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Phone: &quot;</span> + Contact<span style="color: #66cc66;">&#40;</span>collection.<span style="color: #006600;">getItemAt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">phoneNumber</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> serializeContacts<span style="color: #66cc66;">&#40;</span>valueObject:<span style="color: #000000; font-weight: bold;">Class</span>, arryCollection:ArrayCollection<span style="color: #66cc66;">&#41;</span>:ArrayCollection<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// use the the flash.utils.describeType to create an XML of the property names within the object</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">xml</span>:<span style="color: #0066CC;">XML</span> = describeType<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> valueObject<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//trace(xml.toString());</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> properties:XMLList = <span style="color: #0066CC;">xml</span>..<span style="color: #006600;">accessor</span>.<span style="color: #66cc66;">@</span><span style="color: #0066CC;">name</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> tempac:ArrayCollection = <span style="color: #000000; font-weight: bold;">new</span> ArrayCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// iterate through the collection passed into the function and reassign the types to it's objects</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<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> <span style="color: #0066CC;">object</span>:<span style="color: #0066CC;">Object</span> <span style="color: #b1b100;">in</span> arryCollection<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> tempvo:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">new</span> valueObject<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<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> <span style="color: #0066CC;">name</span>:<span style="color: #0066CC;">Object</span> <span style="color: #b1b100;">in</span> properties<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tempvo<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #0066CC;">object</span><span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;tempac.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>tempvo<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">//add the item to collection</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// return an ArrayCollection of the Class file passed into the function</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> tempac;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:script<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:hbox <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;300&quot;</span> x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;10&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">button</span> label=<span style="color: #ff0000;">&quot;Store Contacts&quot;</span> click=<span style="color: #ff0000;">&quot;storeContacts()&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">button</span> label=<span style="color: #ff0000;">&quot;Retrieve Contants&quot;</span> click=<span style="color: #ff0000;">&quot;retrieveContacts()&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:button<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:textarea id=<span style="color: #ff0000;">&quot;outPutText&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;400&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;200&quot;</span> x=<span style="color: #ff0000;">&quot;10&quot;</span> y=<span style="color: #ff0000;">&quot;40&quot;</span><span style="color: #66cc66;">&gt;</span><br />
<span style="color: #66cc66;">&lt;/</span>mx:textarea<span style="color: #66cc66;">&gt;</span></div></td></tr></tbody></table></div>
<p>Now we can store and retrieve ArrayCollections from the EncryptedLocalStore without dealing with the hosed object in our application.  Many thanks to Daniel Dura and Mihai Corlan who helped tackle this problem in their contributions to the community.  Sweet!</p>
<p>Update</p>
<p>I recently read a way to persist typed objects when storing them to the ELS, method outlined on <a href="http://soenkerohde.com/2009/04/encryptedlocalstore-file-variable-with-gettersetter/">Sönke Rohde&#8217;s blog</a>.</p>
<p>-Mister</p>
<p><map name='google_ad_map_213_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/213?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_213_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=213&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fstoring-arraycollection-in-encryptedlocalstore%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/storing-arraycollection-in-encryptedlocalstore/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
