<?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; Flex</title>
	<atom:link href="http://www.thanksmister.com/index.php/archive/tag/flex/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>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>Adding Mac OS X Close Behavior to AIR 1.5 Application</title>
		<link>http://www.thanksmister.com/index.php/archive/adding-mac-os-x-close-behavior-to-air-application/</link>
		<comments>http://www.thanksmister.com/index.php/archive/adding-mac-os-x-close-behavior-to-air-application/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 23:36:29 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=598</guid>
		<description><![CDATA[Just a quick post because I have seen this done on other sites but it no longer is valid in AIR 1.5. Most Mac OS X applications minimize to system tray on closing the application using the &#8220;x&#8221; close button on the app. To achieve this in AIR 1.5 you will need to do the [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick post because I have seen this done on other sites but it no longer is valid in AIR 1.5.   Most Mac OS X applications minimize to system tray on closing the application using the &#8220;x&#8221; close button on the app.   To achieve this in AIR 1.5 you will need to do the following on creationComplete event of the main application:</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 /></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: #808080; font-style: italic;">// on application creation complete setup default Mac OS X behavior</span><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 />
&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> &nbsp;<span style="color: #808080; font-style: italic;">// we are on a Mac</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//this.nativeWindow.addEventListener(InvokeEvent.INVOKE, handleAppInvoke);</span><br />
&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>, handleAppInvoke<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">this</span>.<span style="color: #006600;">nativeWindow</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">CLOSING</span>, handleAppHide<span style="color: #66cc66;">&#41;</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">EXITING</span>, handleAppExit<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">autoExit</span> = <span style="color: #000000; font-weight: bold;">false</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span> &nbsp;<span style="color: #808080; font-style: italic;">// we are on a Windows machine</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0066CC;">this</span>.<span style="color: #006600;">nativeWindow</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">CLOSING</span>, handleAppClosing<span style="color: #66cc66;">&#41;</span>; <br />
&nbsp; &nbsp; NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">autoExit</span> = <span style="color: #000000; font-weight: bold;">true</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">// active that application</span><br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleAppInvoke<span style="color: #66cc66;">&#40;</span>event:InvokeEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<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;">nativeWindow</span>.<span style="color: #006600;">activate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">// close all open windows</span><br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleAppClosing<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span> &nbsp; <br />
&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; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">openedWindows</span>.<span style="color: #0066CC;">length</span> - <span style="color: #cc66cc;">1</span>; i <span style="color: #66cc66;">&gt;</span>= <span style="color: #cc66cc;">0</span>; --i<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NativeWindow<span style="color: #66cc66;">&#40;</span>NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">openedWindows</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">// hide the application instead of closing it</span><br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleAppHide<span style="color: #66cc66;">&#40;</span>event:Event<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: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">this</span>.<span style="color: #006600;">nativeWindow</span>.<span style="color: #0066CC;">visible</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// if the window is visible the event behaviour is canceld and the window is hidden</span><br />
&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: #0066CC;">this</span>.<span style="color: #006600;">nativeWindow</span>.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
<span style="color: #808080; font-style: italic;">// close all open windows, remove event listener for hiding application and close applicatin</span><br />
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleAppExit<span style="color: #66cc66;">&#40;</span>event:Event<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: #0066CC;">this</span>.<span style="color: #006600;">nativeWindow</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">CLOSING</span>, handleAppHide<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">openedWindows</span>.<span style="color: #0066CC;">length</span> - <span style="color: #cc66cc;">1</span>; i <span style="color: #66cc66;">&gt;</span>= <span style="color: #cc66cc;">0</span>; --i<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; NativeWindow<span style="color: #66cc66;">&#40;</span>NativeApplication.<span style="color: #006600;">nativeApplication</span>.<span style="color: #006600;">openedWindows</span><span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></td></tr></tbody></table></div>
<p>- Mister</p>
<p><map name='google_ad_map_598_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/598?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_598_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=598&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fadding-mac-os-x-close-behavior-to-air-application%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/adding-mac-os-x-close-behavior-to-air-application/feed/</wfw:commentRss>
		<slash:comments>5</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>HTTP Status 201 causing Flex #2032 Error in IE only</title>
		<link>http://www.thanksmister.com/index.php/archive/http-status-201-causing-flex-2032-error-in-ie-only/</link>
		<comments>http://www.thanksmister.com/index.php/archive/http-status-201-causing-flex-2032-error-in-ie-only/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 16:40:13 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[2032 Error]]></category>
		<category><![CDATA[HTTPService]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Status 201]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=508</guid>
		<description><![CDATA[I ran into a problem right when we were going to launch a new Flex web-based application to production (of course) with Internet Explorer and Flex. I was calling an RESTful service that returns XML and using the built-in Flex HTTPService with either POST/GET as the method for the request. Most of the service calls [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a problem right when we were going to launch a new Flex web-based application to production (of course) with Internet Explorer and Flex.  I was calling an <a href="http://en.wikipedia.org/wiki/REST">RESTful</a> service that returns XML and using the built-in Flex HTTPService  with either POST/GET as the method for the request.   Most of the service calls either return a HTTP Status Code of 200 (OK) or they throw an error.  For one  POST request that returned a HTTP Status of  &#8220;201 Created&#8221;  Flex threw up a <a href="http://livedocs.adobe.com/flex/201/langref/runtimeErrors.html">2032 Stream Error</a> in response.   Here is a brief definition of the error: </p>
<blockquote><p>
<a href="http://editthis.info/flexerrorcodes/Main_Page">The referenced resource does not exist or the swf is trying to access a file across a restricted domain. </a>
</p></blockquote>
<p>This error causes Flex to report a fault error on the request even though it was successful.   The 201 status code  is handled fine in all other browsers except IE (6 &#038; 7).    I did some research on the issue thinking it must be something easy to fix, that many others have run across before me.    It seems the error is out there for lots of different reasons.  </p>
<p>One post reported that IE was having a caching issues, and the way to solve it was to add a random number on the end of your service calls or you have to set the response headers in your server side page to prevent caching.  This one sounds similar to a <a href="http://thanksmister.com/?p=59">FireFox issue</a> I ran into a couple years back, but didn&#8217;t effect the results:</p>
<p><span id="more-508"></span></p>
<p><a href="http://www.judahfrangipane.com/blog/?p=87">http://www.judahfrangipane.com/blog/?p=87</a></p>
<p>The overwhelming number of posts on the subject suggested that Rails and Adobe both share the responsibility for this error (depending on if you are a Rails dev or a Flex dev, the debate rages as to who is to blame).   The fix seems to be changing status returned from Rails to something other than 201.  This seems to be the legit solution since the web service I was hitting is running Rails:</p>
<p><a href="http://stackoverflow.com/questions/354936/flex-2032-stream-error-in-ie-only">http://stackoverflow.com/questions/354936/flex-2032-stream-error-in-ie-only</a><br />
<a href="http://nachbar.name/blog/2008/06/14/flex-railsprotect_from_forgery-problem-with-rails-21-produces-ioerror-2032/">http://nachbar.name/blog/2008/06/14/flex-railsprotect_from_forgery-problem-with-rails-21-produces-ioerror-2032/</a><br />
<a href="http://onrails.org/articles/2008/02/20/dealing-with-http-errors-in-a-flex-with-rails-application">http://onrails.org/articles/2008/02/20/dealing-with-http-errors-in-a-flex-with-rails-application</a><br />
<a href="http://www.manning-sandbox.com/message.jspa?messageID=64372">http://www.manning-sandbox.com/message.jspa?messageID=64372</a><br />
<a href="http://nachbar.name/blog/tag/adobe-flex-programming/">http://nachbar.name/blog/tag/adobe-flex-programming/</a></p>
<p>If you think Adobe should fix the issue (as some Rails people protest) then you can view all the other bug reports Adobe already had lined up to fix that involve a 2032 Stream Error, just type in Explorer 2032 and you will find them:</p>
<p><a href="http://bugs.adobe.com/jira/secure/QuickSearch.jspa">http://bugs.adobe.com/jira/secure/QuickSearch.jspa</a></p>
<p>The workaround we ended up implemented was totally client based.  In the fault handler of this particular service request, I look for the errorID value of the Fault event and ignore it.   It was all I could do on short notice and I wasn&#8217;t about to convince the backend dudes that we needed to change the server response from 201 to 200, pick your battles and my first battle was to get this app into the war. </p>
<p>For me the real culprit is IE (easy target).  Something that works in every other browser but IE is so friggen familiar to anyone who has done any cross-browser work.  IE sucks, it has always sucked, and it will always suck, period.  My other thought is about web services and codes in general.   As an application developer, I use a lot of different services, consuming data from many different pipes.   I couldn&#8217;t tell you as a consumer of web services and an application designer what the value of having a returned  Status of 201 has over returning a Status of 200, can you?    I make a request, and if the request is good, just tell me ok, I don&#8217;t need to know that the server returned a HTTP Status Code of 311 (the server code for &#8220;I just made you a sandwich&#8221;).  I need to know only two basic things, was the request good, or did it explode?</p>
<p>I think some API dudes and backend dudes are purists, they want server codes to bubble up to the client so we can admire them, even though in practice (meaning you actually build applications with these services) you don&#8217;t really need the extra data.  Hey, I am totally used to having to make 5 service calls to accomplish one thing with a web service, I would never ask for the service to be changed to convenience the client, but some information is superfluous and could be scaled down. </p>
<p><strong>UPDATE</strong></p>
<p>Saw another blog post about the same topic at <a href="http://userflex.wordpress.com/2009/01/08/io-stream-errors-in-air/">UserFlex</a>.    </p>
<p>- Mister</p>
<p><map name='google_ad_map_508_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/508?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_508_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=508&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fhttp-status-201-causing-flex-2032-error-in-ie-only%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/http-status-201-causing-flex-2032-error-in-ie-only/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Smooth Scrolling HorizontalList</title>
		<link>http://www.thanksmister.com/index.php/archive/smooth-scrolling-horizontallist/</link>
		<comments>http://www.thanksmister.com/index.php/archive/smooth-scrolling-horizontallist/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 05:06:04 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[Component]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[HorizontalList]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=450</guid>
		<description><![CDATA[This example is based on Alex Harui&#8217;s Smooth Scrolling List. It just changes the code to work with the HorizontalList control rather than the List control. The SmoothHorizontalScrollingList class extends the HorizontalList control adding the needed functionality to allow smooth scrolling: Example Source file: smoothscrollinghorizontallist.zip Below is the full code for the example. Code 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596package [...]]]></description>
			<content:encoded><![CDATA[<p>This example is based on Alex Harui&#8217;s <a href="http://blogs.adobe.com/aharui/2008/03/smooth_scrolling_list.html">Smooth Scrolling List</a>.  It just changes the code to work with the HorizontalList control rather than the List control.  The SmoothHorizontalScrollingList class extends the HorizontalList control adding the needed functionality to allow smooth scrolling:</p>
<p><span id="more-450"></span></p>
<p><strong>Example</strong></p>
<div id="smoothscroll">
        <object type="application/x-shockwave-flash" id="superimage" data= "http://thanksmister.com/examples/smoothscrollinghorizontallist/smoothscrollinghorizontallist.swf" width="388" height="213"><param name="movie" value= "http://thanksmister.com/examples/smoothscrollinghorizontallist/smoothscrollinghorizontallist.swf" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /></object>
</div>
<p><p>
Source file: <a href="http://thanksmister.com/examples/smoothscrollinghorizontallist/smoothscrollinghorizontallist.zip">smoothscrollinghorizontallist.zip</a></p>
<p>Below is the full code for the example. </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 />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 /></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;">custom</span>.<span style="color: #006600;">controls</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">DisplayObject</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;">MouseEvent</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">HorizontalList</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">core</span>.<span style="color: #006600;">ScrollPolicy</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">effects</span>.<span style="color: #006600;">easing</span>.<span style="color: #66cc66;">*</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">ScrollEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">ScrollEventDetail</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**<br />
&nbsp; &nbsp; &nbsp;* &nbsp;List that uses smooth scrolling<br />
&nbsp; &nbsp; &nbsp;*/</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SmoothHorizontalScrollingList <span style="color: #0066CC;">extends</span> HorizontalList<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</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> fudge:<span style="color: #0066CC;">Number</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> SmoothHorizontalScrollingList<span style="color: #66cc66;">&#40;</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;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; offscreenExtraRowsOrColumns = <span style="color: #cc66cc;">2</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; override protected <span style="color: #000000; font-weight: bold;">function</span> configureScrollBars<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: #0066CC;">super</span>.<span style="color: #006600;">configureScrollBars</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>horizontalScrollBar<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; horizontalScrollBar.<span style="color: #006600;">lineScrollSize</span> = .125; &nbsp;<span style="color: #808080; font-style: italic;">// should be inverse power of 2</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> horizontalScrollPosition<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</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><span style="color: #0066CC;">isNaN</span><span style="color: #66cc66;">&#40;</span>fudge<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; <span style="color: #000000; font-weight: bold;">var</span> vsp:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">super</span>.<span style="color: #006600;">horizontalScrollPosition</span> + fudge;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fudge = <span style="color: #0066CC;">NaN</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> vsp;<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;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">super</span>.<span style="color: #006600;">horizontalScrollPosition</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; override protected <span style="color: #000000; font-weight: bold;">function</span> scrollHandler<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;">// going backward is trickier. &nbsp;When you cross from, for instance 2.1 to 1.9, you need to convince</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// the superclass that it is going from 2 to 1 so the delta is -1 and not -.2.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// we do this by adding a fudge factor to the first return from horizontalScrollPosition</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// which is used by the superclass logic.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> last:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">super</span>.<span style="color: #006600;">horizontalScrollPosition</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> vsp:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">horizontalScrollBar</span>.<span style="color: #006600;">scrollPosition</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>vsp <span style="color: #66cc66;">&lt;</span> last<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: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>last <span style="color: #66cc66;">!</span>= <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>last<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">||</span> vsp <span style="color: #66cc66;">!</span>= <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>vsp<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;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>vsp<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>last<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: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fudge = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>last<span style="color: #66cc66;">&#41;</span> - <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span>horizontalScrollBar.<span style="color: #006600;">scrollPosition</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>last.<span style="color: #006600;">toFixed</span><span style="color: #66cc66;">&#40;</span>2<span style="color: #66cc66;">&#41;</span>, vsp.<span style="color: #006600;">toFixed</span><span style="color: #66cc66;">&#40;</span>2<span style="color: #66cc66;">&#41;</span>, fudge<span style="color: #66cc66;">&#41;</span>;<br />
&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; <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; <span style="color: #0066CC;">super</span>.<span style="color: #006600;">scrollHandler</span><span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> pos:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">super</span>.<span style="color: #006600;">horizontalScrollPosition</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// if we get a THUMB_TRACK, then we need to calculate the position</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// because it gets rounded to an int by the ScrollThumb code, and </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// we want fractional values.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>event is ScrollEvent<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: #000000; font-weight: bold;">var</span> se:ScrollEvent = ScrollEvent<span style="color: #66cc66;">&#40;</span>event<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>se.<span style="color: #006600;">detail</span> == ScrollEventDetail.<span style="color: #006600;">THUMB_TRACK</span><span style="color: #66cc66;">&#41;</span><br />
&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; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>horizontalScrollBar.<span style="color: #006600;">numChildren</span> == 4<span style="color: #66cc66;">&#41;</span><br />
&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: #000000; font-weight: bold;">var</span> downArrow:DisplayObject = horizontalScrollBar.<span style="color: #006600;">getChildAt</span><span style="color: #66cc66;">&#40;</span>3<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> thumb:DisplayObject = horizontalScrollBar.<span style="color: #006600;">getChildAt</span><span style="color: #66cc66;">&#40;</span>2<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pos = <span style="color: #66cc66;">&#40;</span>thumb.<span style="color: #006600;">y</span> - downArrow.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #66cc66;">&#40;</span>downArrow.<span style="color: #006600;">y</span> - thumb.<span style="color: #0066CC;">height</span> - downArrow.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">this</span>.<span style="color: #006600;">maxHorizontalScrollPosition</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// round to nearest lineScrollSize;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pos <span style="color: #66cc66;">/</span>= horizontalScrollBar.<span style="color: #006600;">lineScrollSize</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pos = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">round</span><span style="color: #66cc66;">&#40;</span>pos<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pos <span style="color: #66cc66;">*</span>= horizontalScrollBar.<span style="color: #006600;">lineScrollSize</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//trace(&quot;faked&quot;, pos);</span><br />
&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; <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; <span style="color: #000000; font-weight: bold;">var</span> fraction:<span style="color: #0066CC;">Number</span> = pos - horizontalScrollPosition;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fraction <span style="color: #66cc66;">*</span>= <span style="color: #0066CC;">this</span>.<span style="color: #006600;">columnWidth</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//trace(&quot;was&quot;, listContent.y.toFixed(2));</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listContent.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span>viewMetrics.<span style="color: #0066CC;">left</span> + listContent.<span style="color: #006600;">leftOffset</span> - fraction, listContent.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//trace(&quot;now&quot;, listContent.y.toFixed(2), fraction.toFixed(2), listItems[0][0].data.lastName);</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>The following code is an example of how to use the custom control in a Flex application:</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 /></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:Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;absolute&quot;</span> xmlns:controls=<span style="color: #ff0000;">&quot;com.custom.controls.*&quot;</span> creationComplete=<span style="color: #ff0000;">&quot;init()&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;383&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;388&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; <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> _dataProvider:ArrayCollection;<br />
<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; _dataProvider = <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; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Louis Leakey&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Mary Leakey&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Richard Leakey&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Margaret Mead&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Jane Goodall&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Ruth Benedict&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Franz Boas&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Claude Levi Strauss&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Noam Chomsky&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;James Deetz &quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Sir Arthur Evans&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Pere Bosch-Gimpera&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Kathleen Kenyon&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Colin Renfrew&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Mortimer Wheeler&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Leonard Woolley&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Lewis Binford&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Howard Carte&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Donald Johansen&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Phil Harding&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Alfred Foucher&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Heinrich Schliemann&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Mick Aston&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Barry Cunliffe&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Churchill Babington&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Vere Gordon Childe&quot;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _dataProvider.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>title:<span style="color: #ff0000;">&quot;Gustaf VI Adolf&quot;</span><span style="color: #66cc66;">&#125;</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> getTitle<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</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;">return</span> <span style="color: #0066CC;">data</span>.<span style="color: #006600;">title</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:HBox <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;200&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>controls:SmoothHorizontalScrollingList <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataProvider=<span style="color: #ff0000;">&quot;{_dataProvider}&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>controls:itemRenderer<span style="color: #66cc66;">&gt;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Component<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Text</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;{outerDocument.getTitle(data)}&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:Component<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>controls:itemRenderer<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>controls:SmoothHorizontalScrollingList<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:HBox<span style="color: #66cc66;">&gt;</span><br />
<span style="color: #66cc66;">&lt;/</span>mx:Application<span style="color: #66cc66;">&gt;</span></div></td></tr></tbody></table></div>
<p><strong>Good, but&#8230;</strong></p>
<p>What I would like to do is make it so the list scrolls smoothtly without the the horizontal scroll bars visible.  However, I can&#8217;t yet figure out how to do this by changing just the horizontalScrollPosition, it seems to revert back to the default behavior for scrolling or blows up when you scroll from the right back to the left.  I quickly began to see that to get a smooth scrolling list within Flex you would have to use an VBox or HBox container with a repeater.   This method is outlined by <a href="http://weblogs.macromedia.com/pent/archives/2008/03/itemrenderers_p_3.html">Peter Ent &#8220;itemRenderers: Part 4: States and Transitions&#8221;</a>. </p>
<p><strong>Update</strong></p>
<p>Found an <a href="http://blog.appdivision.com/2009/02/24/flex-overriding-scrolltoindex-in-horizontallist-to-animate-scrolling/">interesting post </a>for overriding the scrollToIndex method of the HorizontalList control to allow for animated scrolling using external buttons, the only issue is that I couldn&#8217;t scroll from the end of the list back to the beginning.    I also found a <a href="http://bkflex.wordpress.com/2007/07/05/flex-3-built-in-data-grid-animation-effects/">blog post</a> about built in animation effects for Flex 3 List controls using mx.effects.DefaultTileListEffect.  However, it seems you need to use this only for a List or TileList component rather than a HorizontalList: <strong> itemsChangeEffect=&#8221;{mx.effects.DefaultListEffect}&#8221; </strong>.   I have not tried this method yet to animate a list, but it may prove promising if its actually what it claims to be. </p>
<p><strong>Another Solution</strong></p>
<p><a href="http://www.returnundefined.com/2009/03/smooth-scrolling-flex-list">Ben Clinkinbeard of &#8220;returned undefined;&#8221; blog and UM fame posted a great little example of a Smooth Scrolling List</a> that takes a List control and wraps it in a Canvas container to achieve the smooth scrolling effect.   This technique has the benefit of keeping the functionality of the list but also allowing you to smoothly scroll the list by using and external tween.  It should be easy to convert this to a horizontal list and retain the smooth scrolling effect.    Of course, the downside to this method is that you have to render the entire list, which wouldn&#8217;t be very pleasant for large data sets, but for my needs this works great since my data set is very small.  I have also experienced some resize issues when deleting items from the list.  Here is an example of a Smooth Scrolling HorizontalList using a modified version of Ben&#8217;s technique:</p>
<div id="smoothscroll">
        <object type="application/x-shockwave-flash" id="superimage" data= "http://thanksmister.com/examples/smoothscrollinghorizontallist/smoothscrollinghorizontallist2.swf" width="388" height="259"><param name="movie" value= "http://thanksmister.com/examples/smoothscrollinghorizontallist/smoothscrollinghorizontallist.swf" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /></object>
</div>
<p>
<p>The code for the SmoothScrollingHorizontalList class:</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 /></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: #808080; font-style: italic;">/**<br />
&nbsp;* &nbsp;Original code from Ben Clinkinbeard (http://www.returnundefined.com/2009/03/smooth-scrolling-flex-list);<br />
&nbsp;* */</span><br />
package com.<span style="color: #006600;">benclinkinbeard</span>.<span style="color: #006600;">controls</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">HorizontalList</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">core</span>.<span style="color: #006600;">Container</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">core</span>.<span style="color: #006600;">ScrollPolicy</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">core</span>.<span style="color: #006600;">mx_internal</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">FlexEvent</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SmoothScrollingHorizontalList <span style="color: #0066CC;">extends</span> HorizontalList<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;">function</span> SmoothScrollingHorizontalList<span style="color: #66cc66;">&#40;</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;">super</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;">// required to ensure all renderers get created</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">setStyle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;paddingRight&quot;</span>, -1 <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;">// parent container will handle scrolling</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; horizontalScrollPolicy = ScrollPolicy.<span style="color: #006600;">OFF</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addEventListener<span style="color: #66cc66;">&#40;</span> FlexEvent.<span style="color: #006600;">UPDATE_COMPLETE</span>, handleUpdateComplete <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> handleUpdateComplete<span style="color: #66cc66;">&#40;</span> event:FlexEvent <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: #000000; font-weight: bold;">var</span> combinedRendererWidth:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// iterate over list of renderers provided by our List subclass</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// but since HorozintalList does not have variable column widths, we use columnWidth</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> renderer:<span style="color: #0066CC;">Object</span> <span style="color: #b1b100;">in</span> renderers <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; combinedRendererWidth += columnWidth;<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;">// list needs to be at least 10 pixels wide to show results</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// and always needs to be 10 pixels wider than the combined width of the renderers</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">width</span> = combinedRendererWidth + <span style="color: #cc66cc;">10</span>; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// need to shrink list height when canvas has a scrollbar so the scrollbar doesn't overlap the list</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">height</span> = <span style="color: #66cc66;">&#40;</span> Container<span style="color: #66cc66;">&#40;</span> parent <span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">maxHorizontalScrollPosition</span> <span style="color: #66cc66;">&gt;</span> 0 <span style="color: #66cc66;">&#41;</span> ? parent.<span style="color: #0066CC;">height</span> - 16 : parent.<span style="color: #0066CC;">height</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// set the row height to height of list</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowHeight = <span style="color: #0066CC;">height</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;">// array of renderers being used in this list</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> renderers<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</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;">// prefix the internal property name with its namespace</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rawArray:<span style="color: #0066CC;">Array</span> = mx_internal::rendererArray;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> arr:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// the rendererArray is a bit messy</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// its an Array of Arrays, except sometimes the sub arrays are empty</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// and sometimes it contains entries that aren't Arrays at all</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> obj:<span style="color: #0066CC;">Object</span> <span style="color: #b1b100;">in</span> rawArray <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: #000000; font-weight: bold;">var</span> rendererArray:<span style="color: #0066CC;">Array</span> = obj as <span style="color: #0066CC;">Array</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;">// make sure we have an Array and there is something in it</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> rendererArray <span style="color: #66cc66;">&amp;&amp;</span> rendererArray.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span><br />
&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; <span style="color: #808080; font-style: italic;">// if there is something in it, the first item is our renderer</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// but this doesn't seem to be the case for HorizontalList because obj[0] is always empty?</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080; font-style: italic;">//arr.push( obj[ 0 ] );</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;arr = rendererArray;<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: #b1b100;">return</span> arr;<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>The source code for the example: <a href="http://thanksmister.com/examples/smoothscrollinghorizontallist/smoothscrollinghorizontallist2.zip">smoothscrollinghorizontallist2.zip</a></p>
<p>-Mister</p>
<p><map name='google_ad_map_450_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/450?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_450_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=450&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fsmooth-scrolling-horizontallist%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/smooth-scrolling-horizontallist/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>PhoneSeek :: Adobe AIR application</title>
		<link>http://www.thanksmister.com/index.php/archive/phoneseek-adobe-air-application/</link>
		<comments>http://www.thanksmister.com/index.php/archive/phoneseek-adobe-air-application/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 05:12:20 +0000</pubDate>
		<dc:creator>Mister</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Cairngorm]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Mate]]></category>
		<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>

		<guid isPermaLink="false">http://thanksmister.com/?p=301</guid>
		<description><![CDATA[PhoneSeek is an application to track any device that uses InstaMapper. InstaMapper is free real-time GPS tracking service. To use InstaMapper you need a GPS enabled device with the free InstaMapper tracking software installed along with a API Key from InstaMapper&#8217;s web site for each device you own. You can track mobile phones (iPhone, G1, [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://farm4.static.flickr.com/3626/3339950794_0e9ba8fc72_o.jpg" class="alignnone" width="231" height="59" border=0 /></p>
<p>PhoneSeek is an application to track any device that uses <a href="http://www.instamapper.com/">InstaMapper</a>. InstaMapper is free real-time GPS tracking service.   To use InstaMapper you need a GPS enabled device with the free InstaMapper tracking software installed along with a API Key from InstaMapper&#8217;s web site for each device you own.   You can track mobile phones (iPhone, G1, Blackberry) or even automobiles.  </p>
<p><strong>Use Case</strong></p>
<p>With PhoneSeek I can add my InstaMapper API Key for my phone and track it from the desktop.   I can also add and track multiple devices.  On my G1 phone, I installed the <a href="http://www.instamapper.com/android">Android</a> version of the InstaMapper tracking software.   This software allows me to send my phone&#8217;s GPS data to InstaMapper service where I can view it either on their website or consume the data through InstaMapper&#8217;s web service.   In PhoneSeek I just add the API Key to begin tracking the advice as soon as your phone starts to transmit GPS data.</p>
<p><strong>Get PhoneSeek</strong></p>
<p><a href="http://thanksmister.com/?page_id=477">Download the latest version from this location.</a></p>
<p><strong>Development Background</strong></p>
<p>PhoneSeek might be used to track devices from your family members, or maybe track down a lost or stolen phone. However, Phoneseek was basically created as a test project to learn <a href="puremvc.org">PureMVC</a> and also experiment with the new <a href="http://code.google.com/apis/maps/documentation/flash/tutorial-flexbuilder.html#AIRDevelopment">Google Maps API SWC</a> for Adobe AIR.  Previous versions of the Google Maps API SWC only worked for web-based applications.</p>
<p>Coming from <a href="http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm">Cairngorm</a> to PureMVC was quite an experience.  At first it was really painful because I had a tendency to over think things, or try to structure things more the Cairngorm ways (like dude, where are my delegates and commands).  </p>
<p>I really had a hard time understanding where to put certain code, like update code, or code to set the window location on startup, and even how to pass around value objects used by more than one view. It took some time to get used to the PureMVC way, but all in all, its not a bad framework to work with.  However, I still prefer Cairngorm and have since started to investigate and really enjoy <a href="http://mate.asfusion.com/">Mate</a>. </p>
<p>Credit for some of the graphics goes to <a href="http://dragonartz.wordpress.com/">DragonArtz Designs</a>.   </p>
<p>- Mister</p>
<p><map name='google_ad_map_301_1452acacd61817fb'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/301?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_301_1452acacd61817fb' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=301&amp;url= http%3A%2F%2Fwww.thanksmister.com%2Findex.php%2Farchive%2Fphoneseek-adobe-air-application%2F' /></p>]]></content:encoded>
			<wfw:commentRss>http://www.thanksmister.com/index.php/archive/phoneseek-adobe-air-application/feed/</wfw:commentRss>
		<slash:comments>5</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>
	</channel>
</rss>
