<?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>Mike Chambers &#187; air</title>
	<atom:link href="http://www.mikechambers.com/blog/category/air/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikechambers.com/blog</link>
	<description>code = joy</description>
	<lastBuildDate>Thu, 29 Jul 2010 18:12:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Adobe AIR 1.5 for Linux is out</title>
		<link>http://www.mikechambers.com/blog/2008/12/18/adobe-air-15-for-linux-is-out/</link>
		<comments>http://www.mikechambers.com/blog/2008/12/18/adobe-air-15-for-linux-is-out/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 17:33:50 +0000</pubDate>
		<dc:creator>mikechambers</dc:creator>
				<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.mikechambers.com/blog/?p=1636</guid>
		<description><![CDATA[You can read more about it here, and download it here.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2008%2F12%2F18%2Fadobe-air-15-for-linux-is-out%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2008%2F12%2F18%2Fadobe-air-15-for-linux-is-out%2F&amp;source=mesh&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>You can read more about it <a href="http://blogs.adobe.com/air/2008/12/adobe_air_15_now_available_for.html">here</a>, and download it <a href="http://get.adobe.com/air/otherversions/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikechambers.com/blog/2008/12/18/adobe-air-15-for-linux-is-out/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CommandProxy : .NET / AIR Integration Proof of Concept</title>
		<link>http://www.mikechambers.com/blog/2008/01/17/commandproxy-net-air-integration-proof-of-concept/</link>
		<comments>http://www.mikechambers.com/blog/2008/01/17/commandproxy-net-air-integration-proof-of-concept/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 18:21:46 +0000</pubDate>
		<dc:creator>mikechambers</dc:creator>
				<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.mikechambers.com/blog/2008/01/17/commandproxy-net-air-integration-proof-of-concept/</guid>
		<description><![CDATA[Two of the most requested features for Adobe AIR have been the ability to launch native executables from an AIR application, and the ability to integrate native libraries into an AIR application. Unfortunately, neither feature will be included in Adobe AIR 1.0. However, this does not mean that you cannot build an AIR application that [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2008%2F01%2F17%2Fcommandproxy-net-air-integration-proof-of-concept%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2008%2F01%2F17%2Fcommandproxy-net-air-integration-proof-of-concept%2F&amp;source=mesh&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Two of the most requested features for <a href="http://www.adobe.com/go/air">Adobe AIR</a> have been the ability to launch native executables from an AIR application, and the ability to integrate native libraries into an AIR application. Unfortunately, neither feature will be included in Adobe AIR 1.0.</p>
<p>However, this does not mean that you cannot build an AIR application that has closer / tighter integration with the underlying operating system. This lower level of integration is possible, but it requires some work on your part. I have put together a proof of concept project, which shows how to integrate Adobe AIR applications with c# / .NET code on any operating system that Adobe AIR currently runs on (Mac and Windows). The project is called <a href="http://code.google.com/p/commandproxy/">CommandProxy</a>. It provides a communication proxy between an AIR application and the underlying operating system and could theoretically work with other web based desktop runtimes (such as <a href="http://wiki.mozilla.org/Prism">Mozilla Prism</a>).</p>
<p>Update : I have posted some additional thoughts on this proof of concept <a href="http://www.mikechambers.com/blog/2008/01/22/commandproxy-its-cool-but-is-it-a-good-idea/">here</a>.<br />
<span id="more-1213"></span><br />
Note, this project is in no way supported by Adobe. This is a proof of concept project that I put together to help developers understand one possible way to extend AIR functionality beyond that that is provided by the runtime.</p>
<p>The general concept behind the project is similar to the <strike>now defunct</strike> <a href="http://artemis.effectiveui.com/">Artemis project</a> (which is Java based). The AIR application communicates with the CommandProxy process to communicate and integrate with the underlying operating system. Currently the command proxy supports launching processes (and getting the output from the processes) as well as taking a screenshot of the user&#8217;s current screen. However, the framework is built in such a manner that it is possible to add new functionality to the proxy.</p>
<p>Here is an overview of the life-cycle of an AIR application using the command proxy.</p>
<p><a href="http://www.flickr.com/photos/mikechambers/2199401003/" title="CommandProxy / AIR Application Lifecycle by mike.chambers, on Flickr"><img src="http://farm3.static.flickr.com/2366/2199401003_55dd51c188.jpg" width="500" height="322" alt="CommandProxy / AIR Application Lifecycle" /></a></p>
<ol>
<li>Command Proxy process is launched by the user. The shortcut for the process passes in the path to the AIR application to launch (or this can be hard coded into the proxy)</li>
<li>The Command Proxy process then launches the AIR application, passing in a communication key, as well as the socket port that the AIR application should use to communicate with the proxy.</li>
<li>The AIR app may then at some point communicate with the proxy to execute a command. For example, it may tell the proxy to launch a specific process.</li>
<li>The proxy executes the specified command.</li>
<li>If appropriate, the proxy then returns any command output back to the AIR application.</li>
<li>The command / response cycle can occur multiple times during the application life-cycle</li>
<li>When the AIR application process is terminated (i.e. the user closes the application), then the proxy process automatically exits.</li>
</ol>
<p>Currently, the project is meant as a proof of concept, and not as a general use framework. This mainly means that there is not a lot of documentation (although the code is fully commented) and if you want to use it, you are going to have to compile the proxy yourself. If there is interest, then I am willing to expand the project to other contributors.</p>
<p>If you wanted to use something like this in a production level application, then you would need to:</p>
<ul>
<li>Compile the CommandProxy</li>
<li>Compile the AIR application</li>
<li>Create the AIR file to install the AIR application</li>
<li>Create a custom installer that first installs the AIR application, and then installs the short cut to the command proxy</li>
</ul>
<p>Instead of launching the AIR application directly, the user would launch the command proxy process, which would then launch the AIR application.</p>
<p>The project is hosted on Google code, and includes the following:</p>
<ul>
<li>Full C# / .NET code, compilable under <a href="http://www.microsoft.com/express/vcsharp/Default.aspx">Visual Studio</a> and <a href="http://www.mono-project.com/Main_Page">Mono</a>. (Screenshots do not work under Mono)</li>
<li>ActionScript 3 library for communicating with the proxy.</li>
<li>Some very basic documentation</li>
</ul>
<p>If you have questions, then post them in the comments and I will try and address them (and maybe create an FAQ on the project page). If there is interest, then I could also create a mail list on Google groups to discuss the project. If you find bugs with the code, then post them on the <a href="http://code.google.com/p/commandproxy/issues/list">project&#8217;s issues page</a>.</p>
<p>I am also hoping to post some examples of AIR apps that use the proxy. <a href="http://www.theflashblog.com">Lee Brimelow</a> built a simple example of an AIR application that takes a screenshot, and then opens it in Photoshop for editing. You can see a demo of that example toward the end of the video posted <a href="http://theflashblog.com/?p=309">here</a> (it is about half way through the video).</p>
<p>Update : The code is released under an <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a>.</p>
<p>You can find more information on the <a href="http://code.google.com/p/commandproxy/">CommandProxy project page</a>.</p>
<p>Update : I have posted some additional thoughts on the code <a href="http://www.mikechambers.com/blog/2008/01/22/commandproxy-its-cool-but-is-it-a-good-idea/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikechambers.com/blog/2008/01/17/commandproxy-net-air-integration-proof-of-concept/feed/</wfw:commentRss>
		<slash:comments>80</slash:comments>
		</item>
		<item>
		<title>Adobe AIR for JavaScript Developers Translated to Thai</title>
		<link>http://www.mikechambers.com/blog/2007/11/26/adobe-air-for-javascript-developers-translated-to-thai/</link>
		<comments>http://www.mikechambers.com/blog/2007/11/26/adobe-air-for-javascript-developers-translated-to-thai/#comments</comments>
		<pubDate>Tue, 27 Nov 2007 00:18:49 +0000</pubDate>
		<dc:creator>mikechambers</dc:creator>
				<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.mikechambers.com/blog/2007/11/26/adobe-air-for-javascript-developers-translated-to-thai/</guid>
		<description><![CDATA[I just noticed over on the labs wiki that the Adobe AIR For JavaScript Developers Pocket Guide has been translated to Thai. You can view the full translation here. Creative Commons FTW!]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F26%2Fadobe-air-for-javascript-developers-translated-to-thai%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F26%2Fadobe-air-for-javascript-developers-translated-to-thai%2F&amp;source=mesh&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I just noticed over on the <a href="http://labs.adobe.com/wiki/index.php/AIR:Books:Adobe_Integrated_Runtime_for_JavaScript_Developers">labs wiki</a> that the Adobe AIR For JavaScript Developers Pocket Guide has been <a href="http://lib.blognone.com/Adobe_Integrated_Runtime_(AIR)_for_JavaScript_Developers">translated to Thai</a>.</p>
<p>You can view the full translation <a href="http://lib.blognone.com/Adobe_Integrated_Runtime_(AIR)_for_JavaScript_Developers">here</a>.</p>
<p><a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons</a> FTW!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikechambers.com/blog/2007/11/26/adobe-air-for-javascript-developers-translated-to-thai/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Introducing the Adobe AIR Logo</title>
		<link>http://www.mikechambers.com/blog/2007/11/15/introducing-the-adobe-air-logo/</link>
		<comments>http://www.mikechambers.com/blog/2007/11/15/introducing-the-adobe-air-logo/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 15:18:50 +0000</pubDate>
		<dc:creator>mikechambers</dc:creator>
				<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.mikechambers.com/blog/2007/11/15/introducing-the-adobe-air-logo/</guid>
		<description><![CDATA[If you have been following Adobe AIR during its young lifetime, then you have probably noticed that it has been pretty inconsistent as far as branding goes. It has had a number of logos and graphics associated with it, including the rocket-ship, and the current &#8220;AIR&#8221; branding. Part of this was due to the surprisingly [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F15%2Fintroducing-the-adobe-air-logo%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F15%2Fintroducing-the-adobe-air-logo%2F&amp;source=mesh&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>If you have been following <a href="http://www.adobe.com/go/air">Adobe AIR</a> during its young lifetime, then you have probably noticed that it has been pretty inconsistent as far as branding goes. It has had a number of logos and graphics associated with it, including the rocket-ship, and the current &#8220;AIR&#8221; branding.</p>
<p>Part of this was due to the surprisingly complex process of designing and settling on a logo in the technology world. There have been quite a few times during the past year where we felt that we were close to having the final logo, only to then find out that it was just a bit too familiar to some other logo in the computer / internet / tech world.</p>
<p>Well, I am happy to say that we have the final logo. I had the honor of showing it for the first time today, at the <a href="http://www.flexeurs.org/rencontre-avec-mike-chambers-et-lee-brimelow-a-l-occasion-du-air-user-group-tour.html">Adobe User group meeting in Paris</a>.<br />
<span id="more-1205"></span><br />
<a href="http://www.flickr.com/photos/mikechambers/2034394938/" title="Adobe AIR 1.0 Logo by mike.chambers, on Flickr"><img src="http://farm3.static.flickr.com/2074/2034394938_9e36bcefe2.jpg" width="500" height="264" alt="Adobe AIR 1.0 Logo" /></a></p>
<p>I am not going to go into a detailed analysis of what the logo represents, but I do want to point out one of the core concepts behind the logo. Adobe AIR is built on top of three core web technologies (HTML, Flash and PDF), and we wanted the logo to represent this. Thus, each corner of the logo represents one of these core technologies.</p>
<p>We are going to be posting some &#8220;Download Adobe AIR&#8221; Badges (88 x 33) over the next couple of days in case you want to show your support for AIR. Feel free to build you own (if you do, post them in the comments). Who knows, if there is enough interest, maybe we will have a contest to see who can make the best Adobe AIR badge or desktop wallpaper (post in the comments if you are interested). (I will upload an vector version of the logo shortly).</p>
<p>One last note. Normally, this is the type of information and news that we would post on the main website and not on a weblog. However, we know that the success of Adobe AIR is dependent on developers and the applications and content that they create. As we have learned from Adobe Reader and the Flash Player, content drives adoption. This is why we are posting the logo here first. We wanted the developer community to be the first to see the new logo.</p>
<p>You can find out more information on <a href="http://www.adobe.com/go/air">Adobe AIR on Adobe Labs</a>.</p>
<p>Update : You can download vector versions of the logo <a href="http://www.mikechambers.com/blog/files/adobe_air_logo.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikechambers.com/blog/2007/11/15/introducing-the-adobe-air-logo/feed/</wfw:commentRss>
		<slash:comments>130</slash:comments>
		</item>
		<item>
		<title>Using the HTMLControl Class in Adobe AIR to parse HTML as a data source</title>
		<link>http://www.mikechambers.com/blog/2007/11/09/using-the-htmlcontrol-in-adobe-air-to-parse-html-as-a-data-source/</link>
		<comments>http://www.mikechambers.com/blog/2007/11/09/using-the-htmlcontrol-in-adobe-air-to-parse-html-as-a-data-source/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 13:40:09 +0000</pubDate>
		<dc:creator>mikechambers</dc:creator>
				<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.mikechambers.com/blog/2007/11/09/using-the-htmlcontrol-in-adobe-air-to-parse-html-as-a-data-source/</guid>
		<description><![CDATA[One of the cool features of Adobe AIR (especially for Flash developers) is its ability to render full featured HTML within Flash content. The rendering is handled by the WebKit core, and the HTML content can be from both local and remote URLs as well as from a string of HTML text. HTML rendering within [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F09%2Fusing-the-htmlcontrol-in-adobe-air-to-parse-html-as-a-data-source%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F09%2Fusing-the-htmlcontrol-in-adobe-air-to-parse-html-as-a-data-source%2F&amp;source=mesh&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>One of the cool features of Adobe AIR (especially for Flash developers) is its ability to render full featured HTML within Flash content. The rendering is handled by the WebKit core, and the HTML content can be from both local and remote URLs as well as from a string of HTML text. </p>
<p>HTML rendering within Flash content is handled by the ActionScript HTMLControl class (which is wrapped by the HTML component in Flex). The HTMLControl class is a DisplayObject instance (it directly inherits from Sprite) and thus renders its HTML directly to the display list.</p>
<p>However, it is possible to load HTML content into an HTMLControl instance, without placing it on the display list to be displayed. HTML content is still loaded and executed, and its DOM is exposed to the scripting environment. This means that you can essentially use the HTMLControl to load and parse HTML with the sole purpose of retrieving data from the HTML&#8230; i.e. using the HTMLControl you can treat HTML as a data source, as if it was XML.<br />
<span id="more-1203"></span><br />
This is done by leveraging the JavaScript APIs within HTML for manipulating the HTML DOM. </p>
<p>Below is a simple example that loads some HTML, and then uses various JavaScript DOM APIs to extract data and information from the HTML. Note that the HTML is never displayed or rendered to the screen.</p>
<p>index.html<br />
<code>
<pre>&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;Example HTML Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;h1&gt;Title 1&lt;/h1&gt;
	&lt;p&gt;This is some sample text for title 1&lt;/p&gt;

	&lt;p id="foo"&gt;This is the foo id&lt;/p&gt;
	&lt;p&gt;&lt;a href="http://onair.adobe.com"&gt;onair&lt;/a&gt;&lt;/p&gt;
	&lt;p&gt;&lt;a href="http://www.adobe.com/go/air"&gt;Adobe AIR&lt;/a&gt;&lt;/p&gt;

	&lt;ul&gt;
		&lt;li&gt;List Item A&lt;/li&gt;
		&lt;li&gt;List Item b&lt;/li&gt;
	&lt;/ul&gt;

&lt;/body&gt;
</pre>
<p></code></p>
<p>HTMLParsingExample.mxml<br />
<code>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" 

	layout="absolute"&gt;

	&lt;mx:Script&gt;
		&lt;![CDATA[
			private var html:HTMLControl;
			private function onLoadAndParseClick():void
			{
				html = new HTMLControl();
				html.addEventListener(Event.COMPLETE, onHTMLLoadComplete);
				html.load(new URLRequest("app-resource:/index.html"));
			}

			private function onHTMLLoadComplete(e:Event):void
			{
				//get a reference to the top level html document
				var document:JavaScriptObject = html.window.document;

				/********** find number of links in html page ************/

				//grab all of the links in the document
				var a:JavaScriptObject = document.links;

				//get the length
				var len:int = a.length;

				trace(len + " links in html page.");

				/*********** Find element by ID and get its value ***********/
				var foo:JavaScriptObject = document.getElementById("foo");
				trace(foo.innerText);

				/*********** Use the document DOM parsing API to parse out LI items **********/

				//get all of the UL items
				var lists:JavaScriptObject = document.getElementsByTagName("ul");

				//make sure we found some
				if(lists.length &gt; 0)
				{
					//grab the first one
					var ul:JavaScriptObject = lists[0];

					//get the child nodes
					var childNodes:JavaScriptObject = ul.childNodes;

					var childLen:int = childNodes.length;
					var tempNode:JavaScriptObject;

					//loop through the nodes looking for LI elements
					for(var j:int = 0; j &lt; childLen; j++)
					{
						tempNode = childNodes[j];
						if(String(tempNode.nodeName).toLowerCase() == "li")
						{
							//print the value of the LI element
							trace("LI Found : " + tempNode.innerHTML);
						}
					}						

				}
			}

		]]&gt;
	&lt;/mx:Script&gt;

	&lt;mx:Button label="Load and Parse" right="10" bottom="10" click="onLoadAndParseClick()"/&gt;

&lt;/mx:WindowedApplication&gt;
</pre>
<p></code></p>
<p>One thing to remember is that when working with the JavaScript APIs from within ActionScript, most of the APIs return JavaScriptObject, JavaScriptArray, and JavaScriptFunction instances (and not ActionScript Objects, Arrays and Functions).</p>
<p>You can view the API docs for all of the AIR classes <a href="http://livedocs.adobe.com/labs/flex3/langref/index.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikechambers.com/blog/2007/11/09/using-the-htmlcontrol-in-adobe-air-to-parse-html-as-a-data-source/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Detecting whether an AIR application has run before</title>
		<link>http://www.mikechambers.com/blog/2007/11/07/detecting-whether-an-air-application-has-run-before/</link>
		<comments>http://www.mikechambers.com/blog/2007/11/07/detecting-whether-an-air-application-has-run-before/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 06:35:57 +0000</pubDate>
		<dc:creator>mikechambers</dc:creator>
				<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.mikechambers.com/blog/2007/11/07/detecting-whether-an-air-application-has-run-before/</guid>
		<description><![CDATA[One of the things that you might need to do when building your application is detecting whether your application has run before. This can be useful if you need to initialize settings, or perhaps prompt the user with some information. Below is a simple example that shows how to detect whether the application has run [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F07%2Fdetecting-whether-an-air-application-has-run-before%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F07%2Fdetecting-whether-an-air-application-has-run-before%2F&amp;source=mesh&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>One of the things that you might need to do when building your application is detecting whether your application has run before. This can be useful if you need to initialize settings, or perhaps prompt the user with some information.</p>
<p>Below is a simple example that shows how to detect whether the application has run before. Basically, it checks for the existence of a file. If it doesn&#8217;t exist, then the app hasn&#8217;t run before, if it does exist, then it means that app has run.<br />
<span id="more-1202"></span><br />
<code>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:WindowedApplication
	xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
		creationComplete="onCreationComplete()"&gt;

	&lt;mx:Script&gt;
		&lt;![CDATA[
			private const FIRST_RUN_TOKEN_FILE:File =
					File.applicationStorageDirectory.resolvePath("firstrun");

			private function onCreationComplete():void
			{
				if(FIRST_RUN_TOKEN_FILE.exists)
				{
					outputField.text = "This application HAS been run before";
				}
				else
				{
					var fs:FileStream = new FileStream();
						fs.open(FIRST_RUN_TOKEN_FILE, FileMode.WRITE);
						fs.close();

						outputField.text = "This application HAS NOT been run before";
				}
			}

			private function onResetClick():void
			{
				if(FIRST_RUN_TOKEN_FILE.exists)
				{
					FIRST_RUN_TOKEN_FILE.deleteFile();
				}
			}
		]]&gt;
	&lt;/mx:Script&gt;
	&lt;mx:Text top="10" left="10" right="10" id="outputField"
					textAlign="center" fontSize="20"/&gt;
	&lt;mx:Button label="Reset First Run Status"
			id="resetButton" click="onResetClick()"
				horizontalCenter="0" width="153" bottom="10"/&gt;

&lt;/mx:WindowedApplication&gt;</pre>
<p></code></p>
<p>If you need to know how many times the app has been run, then you could just write a number to the file and then increment it every-time the app runs.</p>
<p>One thing to keep in mind is that this is not 100% fool proof, as the user could manually delete the file. Thus you should not use this for security, serialization or trial tracking purposes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikechambers.com/blog/2007/11/07/detecting-whether-an-air-application-has-run-before/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>AIR Example : Native Drag and Drop</title>
		<link>http://www.mikechambers.com/blog/2007/11/07/air-example-native-drag-and-drop/</link>
		<comments>http://www.mikechambers.com/blog/2007/11/07/air-example-native-drag-and-drop/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 13:51:15 +0000</pubDate>
		<dc:creator>mikechambers</dc:creator>
				<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.mikechambers.com/blog/2007/11/07/air-example-native-drag-and-drop/</guid>
		<description><![CDATA[Here is a simple example that shows how to enable your Adobe AIR application to accept native drag and drop operations. This is a simple application that allows you to drag a text file into the application and then view its contents. DragAndDropExample.mxml &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;mx:WindowedApplication creationComplete="onCreationComplete()" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"&#62; &#60;mx:Script source="DragAndDropExampleClass.as" /&#62; &#60;mx:TextArea top="10" [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F07%2Fair-example-native-drag-and-drop%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F07%2Fair-example-native-drag-and-drop%2F&amp;source=mesh&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Here is a simple example that shows how to enable your Adobe AIR application to accept native drag and drop operations.</p>
<p>This is a simple application that allows you to drag a text file into the application and then view its contents.<br />
<span id="more-1201"></span><br />
DragAndDropExample.mxml<br />
<code>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:WindowedApplication
	creationComplete="onCreationComplete()"
	xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"&gt;

	&lt;mx:Script source="DragAndDropExampleClass.as" /&gt;

	&lt;mx:TextArea top="10" right="10" bottom="10" left="251"
			id="outputField" /&gt;
	&lt;mx:Text text="Drag a Text File into the Application"
			width="233" height="148" top="11" left="10"/&gt;

&lt;/mx:WindowedApplication&gt;
</pre>
<p></code></p>
<p>DragAndDropExampleClass.as<br />
<code>
<pre>
import flash.desktop.ClipboardFormats;
import flash.desktop.DragManager;
import flash.events.NativeDragEvent;
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;

//called when app has initialized and is about to display
private function onCreationComplete():void
{
	//register for the drag enter event
	addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER, onDragIn);

	//register for the drag drop event
	addEventListener(NativeDragEvent.NATIVE_DRAG_DROP, onDragDrop);
}

//called when the user drags an item into the component area
private function onDragIn(e:NativeDragEvent):void
{
	//check and see if files are being drug in
	if(e.clipboard.hasFormat(ClipboardFormats.FILE_LIST_FORMAT))
	{
		//get the array of files
		var files:Array = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;

		//make sure only one file is dragged in (i.e. this app doesn't
		//support dragging in multiple files)
		if(files.length == 1)
		{
			//accept the drag action
			DragManager.acceptDragDrop(this);
		}
	}
}

//called when the user drops an item over the component
private function onDragDrop(e:NativeDragEvent):void
{
	//get the array of files being drug into the app
	var arr:Array = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;

	//grab the files file
	var f:File = File(arr[0]);

	//create a FileStream to work with the file
	var fs:FileStream = new FileStream();

		//open the file for reading
		fs.open(f, FileMode.READ);

	//read the file as a string
	var data:String = fs.readUTFBytes(fs.bytesAvailable);

		//close the file
		fs.close();

	//display the contents of the file
	outputField.text = data;
}
</pre>
<p></code></p>
<p>One of the cool things about the API, is that you can have specific components within your application accept native drag and drop operations (and not just your entire app).</p>
<p>Note, right now, the app is not doing any checking to confirm that the file is a text file. If you try and drag a binary file into the app you will get weird results. (Im looking into how to check that the file is text based).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikechambers.com/blog/2007/11/07/air-example-native-drag-and-drop/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>AIR Example : HTML Editor with live preview</title>
		<link>http://www.mikechambers.com/blog/2007/11/06/air-example-html-editor-with-live-preview/</link>
		<comments>http://www.mikechambers.com/blog/2007/11/06/air-example-html-editor-with-live-preview/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 16:16:34 +0000</pubDate>
		<dc:creator>mikechambers</dc:creator>
				<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.mikechambers.com/blog/2007/11/06/air-example-html-editor-with-live-preview/</guid>
		<description><![CDATA[As part of my Flash on the Beach Intro to AIR Session, I built a simple HTML Editor with a live preview. I have added comments to the code, and uploaded it to the on AIR tour google repository. This example demonstrates: Using the File API to write a string to a file Using the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F06%2Fair-example-html-editor-with-live-preview%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F11%2F06%2Fair-example-html-editor-with-live-preview%2F&amp;source=mesh&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>As part of my <a href="http://www.flashonthebeach.com/">Flash on the Beach</a> Intro to AIR Session, I built a simple HTML Editor with a live preview. I have added comments to the code, and uploaded it to the <a href="http://code.google.com/p/onairbustour/">on AIR tour google repository</a>.</p>
<p>This example demonstrates:</p>
<ul>
<li>Using the File API to write a string to a file</li>
<li>Using the HTML Control within an application to render a string of HTML</li>
<li>Using the File.browseForSave API to open a native save dialog.</li>
</ul>
<p>Here is the code if you just want to glance at it:<br />
<span id="more-1200"></span><br />
HTMLEditor.mxml<br />
<code>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:WindowedApplication
	xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
	 viewSourceURL="srcview/index.html"&gt;
	&lt;!-- include the code for the main app class --&gt;
	&lt;mx:Script source="HTMLEditorClass.as" /&gt;

	&lt;!-- TextArea used to type in HTML --&gt;
	&lt;mx:TextArea height="172" top="10" left="10" right="10"
		change="onTextChange()"
		id="inputField" /&gt;

	&lt;!-- HTML Control which we use for live preview of HTML --&gt;
	&lt;mx:HTML top="190" left="10" right="10" bottom="41" id="htmlField"/&gt;

	&lt;!-- Save button to save the HTML to a file --&gt;
	&lt;mx:Button label="Save" right="10" bottom="10" click="onSaveClick()"/&gt;

&lt;/mx:WindowedApplication&gt;</pre>
<p></code></p>
<p>HTMLEditorClass.as<br />
<code>
<pre>import flash.events.Event;
import flash.filesystem.File;

//called when the text / html is changed
private function onTextChange():void
{
	htmlField.htmlText = inputField.text;
}

//Called when the user selects a file to save
//html in.
private function onBrowseForSave(e:Event):void
{
	//get a file reference to the file the user selected
	var f:File = File(e.target);

	//create a file stream to write to the file
	var fs:FileStream = new FileStream();

		//open the file for writing
		fs.open(f, FileMode.WRITE);

		//write string of html to file
		fs.writeUTFBytes(inputField.text);

		//close the file
		fs.close();
}

//called when user presses save button
private function onSaveClick():void
{
	//get a reference to the desktop dir
	//this will be used as the default dir that the dialog
	//will open at
	var f:File = File.desktopDirectory;

		//listen for the select event for when the user selects
		//a file to save the html in
		f.addEventListener(Event.SELECT, onBrowseForSave);

		//open the browse for save native dialog, and pass in a title
		//for the dialog
		f.browseForSave("Save HTML File");
}</pre>
<p></code></p>
<p>You can grab the code from the <a href="http://onairbustour.googlecode.com/svn/trunk/projects/HTMLEditor/">on AIR Tour code repository</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikechambers.com/blog/2007/11/06/air-example-html-editor-with-live-preview/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Leopard and Adobe AIR</title>
		<link>http://www.mikechambers.com/blog/2007/10/26/leopard-and-adobe-air/</link>
		<comments>http://www.mikechambers.com/blog/2007/10/26/leopard-and-adobe-air/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 21:26:04 +0000</pubDate>
		<dc:creator>mikechambers</dc:creator>
				<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.mikechambers.com/blog/2007/10/26/leopard-and-adobe-air/</guid>
		<description><![CDATA[A lot of people have been asking whether the Adobe AIR beta currently works on Apple Leopard (OS X 10.5). I pinged the team and they they told me that they are currently doing some testing, and havent run into any major issues yet. However, we are seeing some reports of issues from developers online, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F10%2F26%2Fleopard-and-adobe-air%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F10%2F26%2Fleopard-and-adobe-air%2F&amp;source=mesh&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>A lot of people have been asking whether the <a href="http://www.adobe.com/go/air">Adobe AIR beta</a> currently works on <a href="http://www.apple.com/macosx/">Apple Leopard</a> (OS X 10.5). I pinged the team and they they told me that they are currently doing some testing, and havent run into any major issues yet. However, we are seeing some reports of issues from developers online, so if you are currently working on an AIR app, you might want to wait a little while to upgrade until we have more information.</p>
<p>I installed AIR on Leopard, and all of my apps ran fine (although there were some minor issues with badge install).</p>
<p>I don&#8217;t have any information on Flex Builder, but I will try and install it and see if it works for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikechambers.com/blog/2007/10/26/leopard-and-adobe-air/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>ars technica interview on AIR</title>
		<link>http://www.mikechambers.com/blog/2007/10/12/ars-technica-interview-on-air/</link>
		<comments>http://www.mikechambers.com/blog/2007/10/12/ars-technica-interview-on-air/#comments</comments>
		<pubDate>Fri, 12 Oct 2007 16:55:39 +0000</pubDate>
		<dc:creator>mikechambers</dc:creator>
				<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.mikechambers.com/blog/2007/10/12/ars-technica-interview-on-air/</guid>
		<description><![CDATA[ars technica has an interview up with Ed Finkler, the developer behind the AIR based Spaz Twitter client (which was one of the winners of the AIR Developer Derby). The interview is a good read and why Ed (an HTML / PHP developer) choose AIR, and what his experience was like working with the runtime. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F10%2F12%2Fars-technica-interview-on-air%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mikechambers.com%2Fblog%2F2007%2F10%2F12%2Fars-technica-interview-on-air%2F&amp;source=mesh&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://arstechnica.com/journals/apple.ars/2007/10/11/twitter-with-spaz-air-interview-with-dev-ed-finkler">ars technica</a> has an <a href="http://arstechnica.com/journals/apple.ars/2007/10/11/twitter-with-spaz-air-interview-with-dev-ed-finkler">interview up with Ed Finkler</a>, the developer behind the AIR based <a href="http://funkatron.com/spaz">Spaz Twitter client</a> (which was one of the winners of the <a href="http://labs.adobe.com/showcase/special/airderby/">AIR Developer Derby</a>).</p>
<p>The interview is a good read and why Ed (an HTML / PHP developer) choose AIR, and what his experience was like working with the runtime. It also gives a good explanation of some of the new <a href="http://labs.adobe.com/wiki/index.php/AIR:HTML_Security_FAQ">HTML / JavaScript security changes</a> that were implimented in <a href="http://www.adobe.com/go/air">Beta 2</a>.</p>
<p>You can read the entire article <a href="http://arstechnica.com/journals/apple.ars/2007/10/11/twitter-with-spaz-air-interview-with-dev-ed-finkler">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikechambers.com/blog/2007/10/12/ars-technica-interview-on-air/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
