<?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>bustardcelly &#187; Books</title>
	<atom:link href="http://custardbelly.com/blog/?feed=rss2&#038;cat=11" rel="self" type="application/rss+xml" />
	<link>http://custardbelly.com/blog</link>
	<description>it&#039;s a long story</description>
	<lastBuildDate>Tue, 24 Aug 2010 14:25:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Errata or just a helpful hint?</title>
		<link>http://custardbelly.com/blog/?p=75</link>
		<comments>http://custardbelly.com/blog/?p=75#comments</comments>
		<pubDate>Thu, 04 Sep 2008 01:14:35 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=75</guid>
		<description><![CDATA[For those of you who have a copy of the Adobe Air Create-Modify-Reuse book that myself and Marc Leuchner and Matt Wright (of NoBien fame) authored, we hope you are enjoying it and i also may have a bit of errata for Chapter 1 if you are running Leopard. For those of you who don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who have a copy of the <a href="http://www.amazon.com/Adobe-AIR-Create-Modify-Programmer/dp/0470182075/ref=pd_bbs_sr_1?ie=UTF8&#038;s=books&#038;qid=1220490556&#038;sr=8-1" target="_blank">Adobe Air Create-Modify-Reuse book</a> that myself and <a href="http://blog.nobien.net/" target="_blank">Marc Leuchner and Matt Wright (of NoBien fame)</a> authored, we hope you are enjoying it and i also may have a bit of errata for Chapter 1 if you are running Leopard. For those of you who don&#8217;t have a copy of the <a href="http://www.amazon.com/Adobe-AIR-Create-Modify-Programmer/dp/0470182075/ref=pd_bbs_sr_1?ie=UTF8&#038;s=books&#038;qid=1220490556&#038;sr=8-1" target="_blank">book</a> (go buy it) and/or are running Leopard and want to use the Flex SDK command line tools, this may be of interest&#8230;</p>
<p>In Chapter 1 of the Adobe AIR Create-Modify-Reuse book, <em>The Development Environment</em>, it states that in order to set a PATH variable for your command line tools that you should:</p>
<p><strong>1.</strong> Open the Terminal and type <strong>> open -e .profile</strong><br />
<strong>2.</strong> Add the path to the /bin folder of your SDK installation (I paraphrased&#8230; but you get the idea)</p>
<p>In Tiger this is all well and good, and if you are running in Tiger you can drop off or read on if you intend to upgrade to Leopard. Setting system paths in Leopard has changed and you no longer have a <em>.profiles</em> file in your User directory to which you can add/append paths. The following steps are what i took to add a path to the Flex SDK command line tools under Leopard:</p>
<p><strong>1.</strong> Open the Terminal and navigate to /etc/paths.d<br />
<strong>2.</strong> Create a file named &#8216;flex&#8217; &#8211; (sans quotes)<br />
<strong>3.</strong> Enter the following command: <strong>> pico flex</strong><br />
<strong>4.</strong> Enter: <strong>/Applications/flex_sdk_3/bin</strong><br />
<strong>5.</strong> Exit and Save</p>
<p>You will need to restart your computer.</p>
<p><em>*Note: /Applications/flex_sdk_3/bin points to the /bin directory of my Flex 3 SDK installation, change as you see fit to your installation.</em></p>
<p>I can&#8217;t go into the long and short of why this needs to take place in Leopard, but that will get you up and running with the command line tools if running under Leopard; i can however tell you i used the following to set me on the right path (no pun intended):</p>
<p><a href="http://littlesquare.com/2008/01/24/upgraded-to-leopard-making-use-of-etcpathsd-and-path_helper/" target="_blank">here</a> and <a href="http://old.blog.elliottcable.name/articles/2007/10/leopard-paths" target="_blank"> here</a> </p>
<p>I apologise if anyone had purchased <a href="http://www.amazon.com/Adobe-AIR-Create-Modify-Programmer/dp/0470182075/ref=pd_bbs_sr_1?ie=UTF8&#038;s=books&#038;qid=1220490556&#038;sr=8-1" target="_blank">the book</a> and tried to go through Chapter 1 with a Leopard installation. I did not know that setting PATH variables had changed and I was running Tiger when written and up until about a couple weeks ago when my HD went on the lam and i was greeted by a series of &#8216;Do Not Enter&#8217; and &#8216;Missing File&#8217; icons on start-up&#8230; all is well though, and they replaced my HD and installed Leopard for free!</p>
<p>For those of you have a copy of the book, i hope you are enjoying it. For those who are trying to get the tools up and running and just switched to Leopard i hope this is useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=75</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 3 Cookbook clarifications</title>
		<link>http://custardbelly.com/blog/?p=73</link>
		<comments>http://custardbelly.com/blog/?p=73#comments</comments>
		<pubDate>Wed, 16 Jul 2008 00:01:41 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=73</guid>
		<description><![CDATA[Josh Noble &#8211; the main man behind the Flex 3 Cookbook of which i had the esteem pleasure of being part of (thanks again, j-man) &#8211; has recently blogged about some more information involving the files for download and the intention of the book.
Wanted to blog about it as well, as i feel there is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://thefactoryfactory.com/wordpress/" target="_blank">Josh Noble</a> &#8211; the main man behind the <a href="http://www.amazon.com/Flex-Cookbook-Code-Recipes-Developers-Developer/dp/0596529856/ref=pd_sim_b_2" target="_blank">Flex 3 Cookbook</a> of which i had the esteem pleasure of being part of (thanks again, j-man) &#8211; has <a href="http://thefactoryfactory.com/wordpress/?p=435">recently blogged</a> about some more information involving the files for download and the intention of the book.</p>
<p>Wanted to blog about it as well, as i feel there is some great information from his post about the decision for cutting chapters and where to download code and the best way to submit errata. He also mentions the heartbreaking decision to cut chapters and recipes from the book to preserve page count&#8230; but don&#8217;t put the book back on the shelf, they are available to download!</p>
<p>We hope people are enjoying the book at what any level developer you are. Cheers to Josh and happy coding!</p>
<p><a href="http://thefactoryfactory.com/wordpress/?p=435">read Josh&#8217;s post</a></p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=73</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Looking back and looking forward</title>
		<link>http://custardbelly.com/blog/?p=69</link>
		<comments>http://custardbelly.com/blog/?p=69#comments</comments>
		<pubDate>Sun, 24 Feb 2008 15:22:28 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Apollo]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Infrared5]]></category>
		<category><![CDATA[Red5]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=69</guid>
		<description><![CDATA[For those of you that still follow this blog, you may have noticed that i have not been too knee-deep in blogging. A measly 5 posts ago, i rambled on about what 2007 might bring. Needless to say it had kept me pretty busy &#8211; and for all good reason. I have had the opportunity [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you that still follow this blog, you may have noticed that i have not been too knee-deep in blogging. A measly 5 posts ago, <a href="http://custardbelly.com/blog/?p=58" target="_blank">i rambled on</a> about what 2007 might bring. Needless to say it had kept me pretty busy &#8211; and for all good reason. I have had the opportunity to work alongside some unbelievably talented people and be a part of two amazing books focused on <a href="http://labs.adobe.com/technologies/air/" target="_blank">Adobe AIR</a> and <a href="http://labs.adobe.com/technologies/flex/" target="_blank">Flex 3</a> that will be hitting shelves soon. I also accepted a position at <a href="http://www.infrared5.com" target="_blank">Infrared5</a> and am looking forward to working with some of the most insane and brilliant minds in the industry.</p>
<p><a href="http://www.amazon.com/Adobe-AIR-Create-Modify-Reuse/dp/0470182075/ref=pd_bbs_sr_8?ie=UTF8&#038;s=books&#038;qid=1203806020&#038;sr=8-8"><img src="http://www.custardbelly.com/blog/images/air_cmr.jpg" alt="AIR Create-Modify-Reuse" /></a><br />
Marc Leuchner and Matt Wright (of <a href="http://blog.nobien.net/" target="_blank">NoBien</a> fame) and I have been burning the midnight oil to deliver an exciting book on <a href="http://www.amazon.com/Adobe-AIR-Create-Modify-Reuse/dp/0470182075/ref=pd_bbs_sr_8?ie=UTF8&#038;s=books&#038;qid=1203806020&#038;sr=8-8">Adobe AIR &#8211; AIR Create-Reuse-Modify</a> from Wiley Wrox press. Each chapter walks through building applications as you learn about the AIR API. We had a lot of fun architecting and writing about each application that highlights specific facets of the platform and hope it is as much fun to read. Adobe AIR and the API is part of the Flex 3 SDK, which might be <a href="http://www.onflex.org/ted/2008/02/flex-30-and-air-10-are-days-away.php" target="_blank">coming out soon</a>&#8230;</p>
<p><a href="http://www.amazon.com/Flex-3-Cookbook-Joshua-Noble/dp/0596529856/ref=pd_bbs_sr_1?ie=UTF8&#038;s=books&#038;qid=1203806666&#038;sr=8-1"><img src="http://www.custardbelly.com/blog/images/cookbook.jpg" alt="Flex 3 cookbook" /></a><br />
Well, i didn&#8217;t stop at discussing one part of the Flex 3 SDK and also was asked by <a href="http://thefactoryfactory.com/wordpress/" target="_blank">Josh Noble</a> to be a co-author for the <a href="http://www.amazon.com/Flex-3-Cookbook-Joshua-Noble/dp/0596529856/ref=pd_bbs_sr_1?ie=UTF8&#038;s=books&#038;qid=1203806666&#038;sr=8-1">Flex 3 Cookbook</a> from the O&#8217;Reilly press. We&#8217;ve gathered the submissions from the Adobe <a href="http://www.adobe.com/cfusion/communityengine/index.cfm?event=homepage&#038;productId=2" target="_blank">online cookbook</a> and Josh has been steering the cookbook ship to greatness. If you are unfamiliar with the <a href="http://www.oreilly.com/store/series/cookbooks.csp" target="_blank">O&#8217;Reilly cookbook</a> format, the book is designed to present hundreds of &#8216;recipes&#8217; aimed at solving programming problems. I have had the extreme pleasure to write about parts of the Flex API that i love and believe to be essential to RIAs developed using the Flash Platform.</p>
<p>If writing didn&#8217;t keep me busy enough, I worked with some amazing people while building applications that stretched the possibilities of what online and desktop applications built in Flex can do. Along the way i learned more about the business, some agile practices (which i hope to write about some) and how to have fun and love what i do. It is an amazing thing.</p>
<p><a href="http://infrared5.com" target="_blank"><img src="http://www.custardbelly.com/blog/images/infrared5.gif" alt="Infrared5" /></a><br />
I also have had the opportunity to join the <a href="http://www.infrared5.com" target="_blank">Infrared5</a> team and could not be happier. Infrared5 is a consulting company started by Chris Allen, Rebecca Allen and Dominick Accattato focused on architecting applications using the Flash Platform and Red5 Server technologies. <a href="http://bit-101.com/blog" target="_blank">Keith</a> summed it up pretty well <a href="http://www.bit-101.com/blog/?p=1163#comments">in this post</a>. I am honored to be in company with some of the brightest minds in the field that keep me laughing throughout the day. Once I stop breaking things around the office, i can settle in and learn something <img src='http://darko.liquidweb.com/~custardb/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>All in all, 2007 was a great year and i am making out 2008 to be even better. Here&#8217;s to posting more!</p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=69</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AIR InvokeEvent and FileTypes</title>
		<link>http://custardbelly.com/blog/?p=62</link>
		<comments>http://custardbelly.com/blog/?p=62#comments</comments>
		<pubDate>Fri, 05 Oct 2007 13:24:46 +0000</pubDate>
		<dc:creator>todd anderson</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Apollo]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://custardbelly.com/blog/?p=62</guid>
		<description><![CDATA[As some of you may know, Matt Wright and Marc Leuchner (of nobien fame) and I are authoring an Adobe AIR book to be published by Wiley. We&#8217;ve been breaking fingernails typing away to deliver a jam-packed by-examples book in which you&#8217;ll build real world applications while learning about the AIR API. As we&#8217;re writing, [...]]]></description>
			<content:encoded><![CDATA[<p>As some of you may know, <a href="http://www.designhonky.com/" target="_blank">Matt Wright</a> and <a href="http://www.forwardatlantic.com/marc/2006/" target="_blank">Marc Leuchner</a> (of <a href="http://blog.nobien.net/" target="_blank">nobien</a> fame) and I are authoring an <a href="http://www.amazon.com/Adobe-AIR-Create-Modify-Reuse/dp/0470182075/ref=pd_bbs_sr_6/002-5985048-8156021?ie=UTF8&#038;s=books&#038;qid=1191543407&#038;sr=8-6" target="_blank">Adobe AIR book</a> to be published by <a href="http://www.wiley.com/WileyCDA/" target="_blank">Wiley</a>. We&#8217;ve been breaking fingernails typing away to deliver a jam-packed by-examples book in which you&#8217;ll build real world applications while learning about the AIR API. As we&#8217;re writing, we run across some amazing features in AIR and yammer amongst ourselves &#8211; or to anyone who listens &#8211; but rarely blog about our excitement and findings.</p>
<p>That said, there is a coupling of features of AIR while leveraging the Flex Framework that i cannot hold inside and think is worth mentioning: Associated filetypes, the invoke event, and BindingUtils. </p>
<p><em>To view and download the full code, <a href="http://custardbelly.com/downloads/air/FileTypeFun" target="blank">click here</a>.<br />
</em><br />
<strong>File Types</strong><br />
First off, you can associate filetypes to your AIR app in the application descriptor file within the <code>fileTypes</code> node:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;filetypes<span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;">&lt;filetype<span style="color: #7400FF;">&gt;</span></span>
      <span style="color: #000000;">&lt;name<span style="color: #7400FF;">&gt;</span></span>com.example<span style="color: #000000;">&lt;/name<span style="color: #7400FF;">&gt;</span></span>
      <span style="color: #000000;">&lt;extension<span style="color: #7400FF;">&gt;</span></span>ftf<span style="color: #000000;">&lt;/extension<span style="color: #7400FF;">&gt;</span></span>
      <span style="color: #000000;">&lt;description<span style="color: #7400FF;">&gt;</span></span>FileTypeFun file<span style="color: #000000;">&lt;/description<span style="color: #7400FF;">&gt;</span></span>
      <span style="color: #000000;">&lt;contenttype<span style="color: #7400FF;">&gt;</span></span>text/plain<span style="color: #000000;">&lt;/contenttype<span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;">&lt;/filetype<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;/filetypes<span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Once the AIR app is installed on your machine, a file with the extension set as the value of the <code>extension</code> node will be associated with your app. Meaning, it will show up first in the list when you choose &#8216;open with&#8217; and even invoke the app if you double-click on the file &#8211; that is if the extension is not associated with another program on your machine (ie. doc) in which case you will have to set your app to always open associated as default to your app.</p>
<p><strong>InvokeEvent</strong><br />
The invoke event of a <code>WindowedApplication</code> will be triggered upon initial instantiation &#8211; without having the application previously running &#8211; and any subsequent &#8216;open with file&#8217; calls. The arguments property of the <code>InvokeEvent</code> is an array of arguments passed through invocation of the app. This not only allows command line junkies to open an application with a file like so:</p>
<p><em>On Mac:</em><br />
>open MyAirApp.app MyDocuments.ftf<br />
<em><br />
On Windows:</em><br />
>MyAirApp MyDocument.ftf</p>
<p>.. but as well as double-clicking or choosing &#8216;open with&#8217; on a file (as describe above). Probably you wouldn&#8217;t have any documents lying around in your applications directory &#8211; but you get the picture. To handle those arguments your app would look something like as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt; ?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;mx :WindowedApplication </span>
<span style="color: #000000;">    xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">    layout=<span style="color: #ff0000;">&quot;vertical&quot;</span> </span>
<span style="color: #000000;">    horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">    invoke=<span style="color: #ff0000;">&quot;onAppInvoke(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :Script<span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt; !<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            private function onAppInvoke<span style="color: #66cc66;">&#40;</span> evt:InvokeEvent <span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var items:Array = evt.arguments;</span>
<span style="color: #000000;">                for<span style="color: #66cc66;">&#40;</span> var i:int = <span style="color: #cc66cc;">0</span>; i &lt; items.length; i++ <span style="color: #66cc66;">&#41;</span></span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                    trace<span style="color: #66cc66;">&#40;</span> items<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;">&lt;mx :Label text=<span style="color: #ff0000;">&quot;Welcome&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p><em>Note:<br />
AARG&#8230; i can&#8217;t find a decent mxml plugin for Wordpress. There is an errant closing</em> mx <em>tag before the script and the closing tag at the end should read</em> /mx:WindowedApplication . <em>If anyone has any tips on a good plugin, please leave a comment!</em></p>
<p>This assigns the <code>onAppInvoke()</code> method as the handler to the &#8216;invoke&#8217; event dispatched from <code>WindowedApplication</code> upon instantiation AND any subsequent invocation calls. The arguments attribute of the <code>InvokeEvent</code> is a list of strings &#8211; deliminated by space if you on the command line. From here, just handle them as you want to. In following with this example we are going to handle paths to simple text files.</p>
<p><strong>BindingUtils</strong><br />
All this filetypes and invoke events craziness is enough to warrent me to stop writing&#8230; but i got to thinking (always bad news)&#8230; what if i&#8217;ve got an &#8216;invoke&#8217; event that may trigger prior to the creation of a client that needs to know about an opened file, or more so, the app needs to switch focus to a client that has yet to be instantiated that knows how to handle that file? This is where <code>BindingUtils </code>and <code>ChangeWatcher </code>come into play and really show off the power of the Flex Framework.</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt; ?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;mx :WindowedApplication </span>
<span style="color: #000000;">    xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">    layout=<span style="color: #ff0000;">&quot;vertical&quot;</span> </span>
<span style="color: #000000;">    horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">    applicationComplete=<span style="color: #ff0000;">&quot;onAppComplete();&quot;</span></span>
<span style="color: #000000;">    invoke=<span style="color: #ff0000;">&quot;onAppInvoke(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span>&lt;mx :Script<span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt; !<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import mx.binding.utils.ChangeWatcher;</span>
<span style="color: #000000;">            import mx.binding.utils.BindingUtils;</span>
<span style="color: #000000;">            import mx.events.FlexEvent;</span>
&nbsp;
<span style="color: #000000;">            private var _invokedFile:File;</span>
<span style="color: #000000;">            private var _fileWindow:FileDisplayWindow;</span>
<span style="color: #000000;">            private var _filesBinding:ChangeWatcher;</span>
&nbsp;
<span style="color: #000000;">            private function onAppComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                _filesBinding = BindingUtils.bindSetter<span style="color: #66cc66;">&#40;</span> invalidateFiles, this, <span style="color: #ff0000;">'invokedFile'</span>, true <span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            private function onAppInvoke<span style="color: #66cc66;">&#40;</span> evt:InvokeEvent <span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var items:Array = evt.arguments;</span>
<span style="color: #000000;">                if<span style="color: #66cc66;">&#40;</span> items.length <span style="color: #7400FF;">&gt;</span></span> 0 )
                {
                    invokedFile = new File( evt.arguments[0] );
                }    
            }
&nbsp;
            private function openFileWindow():void
            {
                _fileWindow = new FileDisplayWindow();
                _fileWindow.addEventListener( FlexEvent.CREATION_COMPLETE, applyFileToWindow );
                _fileWindow.open();
            }
&nbsp;
            private function applyFileToWindow( evt:FlexEvent = null ):void
            {
                _fileWindow.file = _invokedFile;
            }
&nbsp;
            private function invalidateFiles( arg:* = null ):void
            {
                if( _invokedFile == null ) return;
                if( _fileWindow == null || _fileWindow.closed ) openFileWindow();
                else applyFileToWindow();
            }
&nbsp;
            [Bindable]
            public function get invokedFile():File
            {
                return _invokedFile;
            }
            public function set invokedFile( arr:File ):void
            {
                _invokedFile = arr;
            }
&nbsp;
        ]]&gt;
    <span style="color: #000000;">&lt;mx :Label text=<span style="color: #ff0000;">&quot;Welcome&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;">&lt;/mx<span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p><em>Note:<br />
Again i apologize for the terrible representation of mxml code. To view the full code,</em> <a href="http://custardbelly.com/downloads/air/FileTypeFun" target="blank">click here</a></p>
<p>On dispatch of &#8216;applicationComplete&#8217;, a <code>ChangeWatcher </code>instance is created to bind any changes to the <code>invokeFile </code>attribute to the <code>invalidateFiles()</code> method. The <code>invalidateFiles()</code> method will be called upon a change to the <code>invokedFile </code>which is of type <code>File </code>from the AIR API. The client that handles any invoked files in this case is another addition to the AIR API &#8211; Window. I threw it in there because i can&#8217;t stop wanting to use it <img src='http://darko.liquidweb.com/~custardb/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The <code>invalidateFiles()</code> has checks to see if the file is valid as well as to make sure the <code>Window </code>is open and ready to receive data. Basically, with binding a change to the <code>invokedFile </code>attribute to the i<code>nvalidateFiles()</code> handler, we can be sure that when a file is requested to be open &#8211; either through invocation from the command, double-click, or &#8216;open with&#8217; &#8211; the <code>Window </code>client that knows how to handle that file data will be presented.</p>
<p>This just scratches the surface. There are icons you can associate with file types, there&#8217;s drag and drop capabilities that can update the invoked file if wanted&#8230; i just have to stop typing at some point!</p>
<p><a href="http://custardbelly.com/downloads/air/FileTypeFun" target="blank">View the full source code here.</a> I didn&#8217;t offer up the air app to download because it&#8217;s a rather boring app, but it is included in the source if you want to install it and test out the invocation.</p>
<p>If you made it this far and haven&#8217;t checked out <a href="http://labs.adobe.com/technologies/air/" target="_blank">AIR</a>, go <a href="http://labs.adobe.com/" target="_blank">download the bits</a>. And maybe consider buying <a href="http://www.amazon.com/Adobe-AIR-Create-Modify-Reuse/dp/0470182075/ref=pd_bbs_sr_6/002-5985048-8156021?ie=UTF8&#038;s=books&#038;qid=1191552882&#038;sr=8-6">a book</a> or <a href="http://amazon.com/s/ref=nb_ss_gw/102-6567738-0807350?initialSearch=1&#038;url=search-alias%3Daps&#038;field-keywords=Adobe+AIR&#038;Go.x=0&#038;Go.y=0&#038;Go=Go"> two</a>&#8230; <img src='http://darko.liquidweb.com/~custardb/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://custardbelly.com/blog/?feed=rss2&amp;p=62</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
