<?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>Jonathan Campos&#039; Blog &#187; Netflix Flex API</title>
	<atom:link href="http://www.unitedmindset.com/jonbcampos/category/development/netflix-flex-api/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unitedmindset.com/jonbcampos</link>
	<description>Blog on technology and software development typically around Adobe Flash, Flex, and AIR.</description>
	<lastBuildDate>Mon, 07 Nov 2011 22:32:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Queue Manager for Sony Tablets</title>
		<link>http://www.unitedmindset.com/jonbcampos/2011/10/27/queue-manager-for-sony-tablets/</link>
		<comments>http://www.unitedmindset.com/jonbcampos/2011/10/27/queue-manager-for-sony-tablets/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 03:33:41 +0000</pubDate>
		<dc:creator>jonbcampos</dc:creator>
				<category><![CDATA[Air for Android]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Netflix Flex API]]></category>
		<category><![CDATA[queue manager]]></category>

		<guid isPermaLink="false">http://www.unitedmindset.com/jonbcampos/?p=2564</guid>
		<description><![CDATA[Today I am releasing a custom Queue Manager for the Sony Tablets and the Air App Challenge. Thanks to Adobe AIR and Flex this process was extremely simple. Feel free to poke through if you have a Netflix account. This new version uses the newest versions of Flex and AIR. Feel free to leave comments [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.unitedmindset.com/jonbcampos/wp-content/uploads/2011/10/icon128.png" alt="" title="Queue Manager Icon" width="128" height="128" class="alignleft size-full wp-image-2565" /> Today I am releasing a custom Queue Manager for the Sony Tablets and the Air App Challenge.</p>
<p>Thanks to Adobe AIR and Flex this process was extremely simple. Feel free to poke through if you have a Netflix account. This new version uses the newest versions of Flex and AIR.</p>
<p>Feel free to leave comments and let me know your thoughts.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.unitedmindset.com%2Fjonbcampos%2F2011%2F10%2F27%2Fqueue-manager-for-sony-tablets%2F&amp;title=Queue%20Manager%20for%20Sony%20Tablets" id="wpa2a_2"><img src="http://www.unitedmindset.com/jonbcampos/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.unitedmindset.com/jonbcampos/2011/10/27/queue-manager-for-sony-tablets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Queue Manager on iOS</title>
		<link>http://www.unitedmindset.com/jonbcampos/2011/07/15/queue-manager-on-ios/</link>
		<comments>http://www.unitedmindset.com/jonbcampos/2011/07/15/queue-manager-on-ios/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 19:02:20 +0000</pubDate>
		<dc:creator>jonbcampos</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Netflix Flex API]]></category>
		<category><![CDATA[netflix]]></category>
		<category><![CDATA[queue manager]]></category>

		<guid isPermaLink="false">http://www.unitedmindset.com/jonbcampos/?p=2524</guid>
		<description><![CDATA[Today I&#8217;m releasing my Netflix Queue Manager for the iOS. Thanks to Adobe AIR the process to make this shift from other platforms was very simple. I&#8217;m excited to make this announcement and release. Current State If you are wondering if I feel the app is complete then the answer is NO! This is a [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-2237" title="icon128" src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2010/10/icon128.png" alt="" width="128" height="128" />Today I&#8217;m releasing my Netflix Queue Manager for the iOS. Thanks to Adobe AIR the process to make this shift from other platforms was very simple. I&#8217;m excited to make this announcement and release.</p>
<p><strong>Current State</strong><br />
If you are wondering if I feel the app is complete then the answer is NO! This is a work in progress and I hope you keep updating as I continue to make the app better. Right now I am trying to get through the bare minimum requirements, as I see them. Such as:<br />
- viewing queues<br />
- updating queues<br />
- add/remove/view movies<br />
- update movies queue positions</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.unitedmindset.com%2Fjonbcampos%2F2011%2F07%2F15%2Fqueue-manager-on-ios%2F&amp;title=Queue%20Manager%20on%20iOS" id="wpa2a_4"><img src="http://www.unitedmindset.com/jonbcampos/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.unitedmindset.com/jonbcampos/2011/07/15/queue-manager-on-ios/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>QueueManager on Nook</title>
		<link>http://www.unitedmindset.com/jonbcampos/2011/07/02/queuemanager-on-nook/</link>
		<comments>http://www.unitedmindset.com/jonbcampos/2011/07/02/queuemanager-on-nook/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 22:07:38 +0000</pubDate>
		<dc:creator>jonbcampos</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Netflix Flex API]]></category>

		<guid isPermaLink="false">http://www.unitedmindset.com/jonbcampos/?p=2521</guid>
		<description><![CDATA[Today I&#8217;m releasing my Netflix Queue Manager for the Nook. Thanks to Adobe AIR the process to make this shift from Android was very simple. I&#8217;m excited to make this announcement and release. Current State If you are wondering if I feel the app is complete then the answer is NO! This is a work [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-2237" title="icon128" src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2010/10/icon128.png" alt="" width="128" height="128" />Today I&#8217;m releasing my Netflix Queue Manager for the Nook. Thanks to Adobe AIR the process to make this shift from Android was very simple. I&#8217;m excited to make this announcement and release.</p>
<p><strong>Current State</strong><br />
If you are wondering if I feel the app is complete then the answer is NO! This is a work in progress and I hope you keep updating as I continue to make the app better. Right now I am trying to get through the bare minimum requirements, as I see them. Such as:<br />
- viewing queues<br />
- updating queues<br />
- add/remove/view movies<br />
- update movies queue positions</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.unitedmindset.com%2Fjonbcampos%2F2011%2F07%2F02%2Fqueuemanager-on-nook%2F&amp;title=QueueManager%20on%20Nook" id="wpa2a_6"><img src="http://www.unitedmindset.com/jonbcampos/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.unitedmindset.com/jonbcampos/2011/07/02/queuemanager-on-nook/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>360Flex: Red Carpet Rumble</title>
		<link>http://www.unitedmindset.com/jonbcampos/2011/04/11/360flex-red-carpet-rumble/</link>
		<comments>http://www.unitedmindset.com/jonbcampos/2011/04/11/360flex-red-carpet-rumble/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 07:00:05 +0000</pubDate>
		<dc:creator>jonbcampos</dc:creator>
				<category><![CDATA[Air for Android]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Netflix Flex API]]></category>

		<guid isPermaLink="false">http://www.unitedmindset.com/jonbcampos/?p=2503</guid>
		<description><![CDATA[This is the application created by Antonio Holguin and myself for our 360Flex presentation. This app is a &#8220;semi&#8221; playable version of the game we are creating tentatively called &#8220;Red Carpet Rumble&#8221;. If you have an Android device you can use this link to get the game. Disclaimer: By no means do we feel that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://unitedmindset.com/badassgame/MobileGame.apk"><img src="http://www.unitedmindset.com/jonbcampos/wp-content/uploads/2011/04/001_splash-300x180.jpg" alt="" title="001_splash" width="300" height="180" class="alignnone size-medium wp-image-2505" /></a><br />
This is the application created by <a href="http://twitter.com/antonioholguin">Antonio Holguin</a> and myself for our 360Flex presentation.</p>
<p>This app is a &#8220;semi&#8221; playable version of the game we are creating tentatively called &#8220;Red Carpet Rumble&#8221;.</p>
<p>If you have an Android device you can use <a href="http://unitedmindset.com/badassgame/MobileGame.apk">this link to get the game</a>.</p>
<p>Disclaimer: By no means do we feel that this application is completely done. Yes, we have the full intention of continuing to work on this game and get it out. If you have comments feel free to let us know.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.unitedmindset.com%2Fjonbcampos%2F2011%2F04%2F11%2F360flex-red-carpet-rumble%2F&amp;title=360Flex%3A%20Red%20Carpet%20Rumble" id="wpa2a_8"><img src="http://www.unitedmindset.com/jonbcampos/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.unitedmindset.com/jonbcampos/2011/04/11/360flex-red-carpet-rumble/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learn from my mobile mistakes</title>
		<link>http://www.unitedmindset.com/jonbcampos/2010/12/28/learn-from-my-mobile-mistakes/</link>
		<comments>http://www.unitedmindset.com/jonbcampos/2010/12/28/learn-from-my-mobile-mistakes/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 15:02:59 +0000</pubDate>
		<dc:creator>jonbcampos</dc:creator>
				<category><![CDATA[Air for Android]]></category>
		<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Netflix Flex API]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[queue manager]]></category>

		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=2393</guid>
		<description><![CDATA[This blog post could also be &#8220;how to lower your stars in the marketplace&#8221;. I say this because now looking back at having an application in the marketplace for a few months I see many places that I have screwed up and things that I could do much better next time. At the point of [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2010/10/icon128.png" alt="" title="icon128" width="128" height="128" class="alignleft size-full wp-image-2237" />This blog post could also be &#8220;how to lower your stars in the marketplace&#8221;. I say this because now looking back at having an application in the marketplace for a few months I see many places that I have screwed up and things that I could do much better next time.</p>
<p>At the point of writing this I&#8217;m actually really happy with where Queue Manager has gone.<br />
- Queue Manager has almost 50k users<br />
- Queue Manager is listed highly in the Android Market<br />
- Queue Manager is listed as the top Air for Android app on <a href="http://www.appbrain.com/app/queue-manager/air.com.unitedmindset.QueueManager">AppBrain</a><br />
- Queue Manager is listed highly in <a href="http://appaware.org/app.php?packagename=air.com.unitedmindset.QueueManager">AppAware</a><br />
- Queue Manager is awaiting acceptance into the BlackBerry App World<br />
- <a href="http://www.androidcentral.com/android-central-editors-app-picks-october-28-2010?utm_source=feedburner&#038;utm_medium=feed&#038;utm_campaign=Feed:+androidcentral+(Android+Central)">Android Central</a> listed Queue Manager as a top pick in October and it was stated &#8220;it [Queue Manager] has proven to me the viability of Adobe Air as a development platform for Android&#8221;</p>
<p><img src="http://qrcode.kaywa.com/img.php?s=5&#038;d=market%3A%2F%2Fsearch%3Fq%3Dpname%3Aair.com.unitedmindset.QueueManager" alt="qrcode"/><br />
<span id="more-2393"></span></p>
<p>All this success has not been due to my efforts though, I feel that my efforts have only hindered the application&#8217;s success rather than bolster it. I&#8217;m going to go through the things that I&#8217;ve done &#8211; or have been done to me &#8211; that have hurt Queue Manager and what I have done to fix my mistakes.</p>
<p>Some of these mistakes are embarrassing to admit, especially from a developer that has made multiple applications / products before, yet the old issues still creep up if you let them.</p>
<p><strong>Releasing Too Early</strong><br />
This issue was due to my ego more than anything else. I wanted to have the first Air for Android application on the market and guess what? I did it. The second that Air was pushed to the market I followed right up with Queue Manager. What issues did this cause? You can assume and assume correctly that the initial release was buggy, feature depleted, and could have used some good ole&#8217; optimization. In subsequent releases I fixed up these bugs but due to my buggy release I ended up on triage duty for the first week.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Release when the app is ready, not based on some other date</li>
</ul>
<p><strong>Frequent Releases</strong><br />
Part of this issue was due to how far I needed to go to compete with other Netflix applications on the Android market, part of this issue was that I was trying to have a specific feature set out by Adobe Max, part of this issue was that I wasn&#8217;t testing thoroughly enough and had to constantly release bug fixes, and part of this issue was that every time I finished a feature I wanted it out to the market as fast as possible. All of these &#8220;parts&#8221; lead to one thing: upset users. While some users appreciated the frequent releases most told me that they would have preferred if they weren&#8217;t quite as frequent as I was making them. As time has gone on my releases have been less frequent as the amount of changes needed to the application have decreased. Along with that I have been testing more on my application prior to release &#8211; not just testing the feature that I worked on. Finally my app has grown to a very stable state so the bugs have been worked out over time.</p>
<p>I currently sit on releases a day or two just to feel good about them.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Plan releases</li>
<li>- Test throughly so that you&#8217;re not having to follow up a feature release with an immediate bug fix</li>
<li>- Even if you have good code to release, spread it out and possibly merge feature releases</li>
</ul>
<p><strong>Work closely with your API provider</strong><br />
This has actually been one of my biggest problems and a problem I am completely helpless to &#8211; hopefully the app that you make isn&#8217;t dependent on a public API.</p>
<p>The issue is that Netflix provides me X amount of calls against their servers in one day. If Queue Manger gets featured somewhere or a bunch of people decide to use Queue Manager for an extended period of time and Queue Manager hits it&#8217;s Netflix limit then the application starts giving back an error from Netflix. Each time this has happened I have contacted Netflix and they have given me a bump in my limit, yet another few weeks pass by and I start hitting my limit again. I feel for my users, they just want an application that works, yet this is an area that I am completely hopeless.</p>
<p>When this happens I usually end up with a string of 1 star comments in my market reviews.</p>
<blockquote><p>This is particularly bad when I put out a new release because everyone goes and plays with the app to see what has changed. A quarter of my user base could easily put me over my API limit.</p></blockquote>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Give good feedback to the user</li>
<li>- Limit calls to the server</li>
</ul>
<p><strong>Condense your trips</strong><br />
Mobile is great because it is on the go however you can quickly come across places that on the go doesn&#8217;t equal on the web. With this spotty service possibility even the smallest service call may take quite a long time to fully get back. I learned this the hard way with my initial release.</p>
<p>On my testing computer I received each service call I made almost instantly and the computer was quickly able to parse and visualize the data. When my users started working with my application the initial comments I got back were that they didn&#8217;t know if anything was going on. Even after adding visual loading indicators I had users complaining that the application was &#8220;sluggish&#8221; and the data was taking too long to get back.</p>
<p>This lead to another place for optimization and I spent some long nights working on reorganizing the service calls that I made to the Netflix service. This reduced the data that I was receiving from Netflix, sped up the application and especially the loading time. I still have users that say it takes to long, but eventually there is only so much that I can do about the network, their location, and their device.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Give good feedback to the user</li>
<li>- Reduce the amount of data you rely on</li>
</ul>
<p><strong>Double check your app id prior to release!</strong><br />
I thought that I would be the only person to hit this but alas my good friend <a href="http://twitter.com/flashcanon" target="_blank">FlashCanon</a> also fell prey to this. Prior to releasing your app to the Android Market double check your app id in the application descriptor file and make sure you are perfectly happy with it <strong>BECAUSE YOU CAN&#8217;T CHANGE IT LATER!</strong> The name of the app, the programming, the colors, and basically everything else about your app can change between releases but your app id will stay the same and can&#8217;t be changed.</p>
<blockquote><p>I know there are rumors that you can contact Google and ask them to help change your app id but I would recommend just getting this right from the beginning.</p></blockquote>
<p>If you need to change the app id you will just have to put up a new application with the right id and get your users to reinstall the new app. Obviously you will lose the stats and whatever else from your initial release but you will get the id that you were wanting.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Double check your application id!</li>
</ul>
<p><strong>Double check your application descriptor prior to every release</strong><br />
With every release you can remove your application from the Android Market based on the options that are in your application descriptor. There was about a two week period that I removed Queue Manager from the Marketplace because I updated my Flash Builder version and the application descriptor changed just slightly. This slight change altered the filtering options on my application and even my users couldn&#8217;t find the application in a search.</p>
<blockquote><p>Always check your application descriptor and the application manifest. These details lead to filtering in the Android Market.</p></blockquote>
<p>Now prior to every release I read through my application manifest,  double check that the install location is set to auto, and that my user permissions are set properly.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Double check your permissions</li>
<li>- Make sure that the install location is set to auto for app2sd functionality</li>
<li>- Ensure that your icons stay consistent between releases (and exist)</li>
</ul>
<p><strong>Have error tracking code</strong><br />
As I hinted at earlier there are many things that may go wrong with an application. The device may malfunction, the internet signal may fade, or &#8211; the most obvious &#8211; your code may break. Your users will probably be quick to tell you that your application sucks or has failed but be unclear as to what happened. As I am limited and don&#8217;t know what has happened on the server side (delivered by Netflix) I have an entire section of my application that I am unaware of any issues.</p>
<p>That being said I&#8217;ve had to construct an error tracking system within my application to give the users details as to what happened and ultimately deliver to me the error. All this extra work is very helpful to narrowing down the problem. As an added bonus, if you make error reporting very easy on your users they are more apt to sending you the generated error report.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Give good feedback to the user</li>
<li>- Make it easy for the user to submit bugs/issues</li>
</ul>
<p><strong>Have statistics gathering code</strong><br />
I love statistics gathering code because once I know what my users are doing on a statistical level I know where to focus my efforts for development. I&#8217;ve recently learned that my users do two things: search for titles and browse through new instant titles. That&#8217;s it. Knowing this I can focus my development practices around making sure that my application can do what my users want.</p>
<p>Where did I fail on this? Well I didn&#8217;t put in my tracking information till recently. If you are working on an application I recommend <a href="http://code.google.com/p/gaforflash/">GA for Flash</a>.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Add in code to gather use statistics</li>
<li>- Don&#8217;t gather more information than is necessary, this just will cause extra unneeded application chatter</li>
</ul>
<p><strong>Optimize Visuals</strong><br />
My good friend <a href="http://feedgrids.com">Dimi</a> would be proud of me and all the work I did on the icons. Just for the record he designed most of the app and how it looked, I just pieced it all together. The issue was that some of the icons came out as &#8220;crunchy&#8221; (thanks <a href="http://blog.swfhead.com/">Antonio</a>).</p>
<p>I knew to not scale the images yet the icons still came out as &#8220;crunchy&#8221;.</p>
<p>One night I decided to sit down and figure out the problem, it didn&#8217;t take long. The icons that I was using was built at an odd size. Due to the odd size the device has having issues displaying the icon as the device also does some scaling of the icon. However when I rebuilt the icons with their size based on a power of 2 (specifically 36&#215;36) the icon&#8217;s &#8220;crunchy&#8221; look went away and was smooth again.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Look over all images, make sure they are a multiple of 2 (16&#215;16, 36&#215;36, etc)</li>
</ul>
<p><strong>Test on multiple screens</strong><br />
Testing on multiple devices is the bane of my existence. No matter how many devices I get my hands on there is always one more device that makes my app look just a little bit different and horrible at the same time. At a certain point you are going to need to decide for yourself how many devices is &#8220;good enough&#8221; and move forward.</p>
<p>I&#8217;d recommend testing on at least 3 different phones and 1 tablet. These different sizes and resolutions should help get most of the kinks out. When you see your app on these different resolutions and sizes you&#8217;ll probably realize the same two things that I did. Things that were &#8220;a bit&#8221; on the small size are unusable on some devices and things that &#8220;a bit&#8221; on the large size actually look okay.</p>
<blockquote><p>For the most part I&#8217;ve been really happy with the look of my app across many devices. The Flex Team is doing a good job of keeping design stable across multiple screens.</p></blockquote>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Get devices</li>
<li>- Test on devices</li>
</ul>
<p><strong>Never accept &#8220;okay&#8221;</strong><br />
There are a few times that I&#8217;ve had to make the hard decision &#8220;I will cut a corner here so I can get this important bug fixed there&#8221;. I thought that my users wouldn&#8217;t notice and that they would be happy to get one bug fixed even if it meant that the update wasn&#8217;t very significant.</p>
<p>I was wrong.</p>
<p>My users did notice and they punished me for it. Users aren&#8217;t happy for incremental changes and they will comment and rate your application on two levels. The first is an overall score while the second is how much has the app improved from the last update. If the user doesn&#8217;t deem the update important enough you&#8217;ll get a nice 1-star rating for wasting their time with the update. Not nice but it is reality.</p>
<p>After seeing this phenomenon I&#8217;ve been very happy to rate applications that I enjoy with 5 stars, even if the updates seem trivial.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Plan your updates</li>
<li>- Realize that everything is significant and you can&#8217;t skip out anywhere</li>
</ul>
<p><strong>Accept that your users are going to destroy your app</strong><br />
This point was very interesting and something I didn&#8217;t expect. I had a user contact me that the app didn&#8217;t work for them. After a few more emails back and forth I couldn&#8217;t understand what the problem was and was left to just apologizing to the user. Then the user gave me a break through. He had a custom build of the Android OS that gave him a few extra abilities &#8211; including the ability to turn on and off permissions to applications.</p>
<p>Apparently he decided that my application didn&#8217;t need the ability to access the internet but was upset with me when the application couldn&#8217;t access the Netflix API.</p>
<p>The lesson? Sometimes there is nothing you can do.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Accept defeat</li>
</ul>
<p><strong>Unit Test (where possible)</strong><br />
Don&#8217;t have to go far into this subject. Unit tests work, use them. Even if you think you&#8217;re a &#8220;good developer&#8221; they will help.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Write your tests</li>
</ul>
<p><strong>Have a release checklist</strong><br />
This may not seem like very important but I&#8217;ve always found release checklists to be helpful. There were a few times in early releases that I didn&#8217;t follow any checklist and I accidentally left in debug information or my testing api key or a few other issues. All of these caused for some bad releases followed by an immediate secondary release followed by upset users.</p>
<p>I recommend writing a script for you to follow when you are making a release. Make sure all of your testing bits are in the script, any settings you have to change, and double check your application descriptor. Once your checklist is completed then make your release.</p>
<p>I originally didn&#8217;t do all this with my app as I considered it a &#8220;small&#8221; app and suspected I could remember all these steps off the cuff. I quickly learned that there is no such thing as a small app and every detail matters.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Make a script</li>
<li>- Follow your script each time</li>
</ul>
<p><strong>Include your contact information</strong><br />
Finally, give your users a way to contact you. I&#8217;ve found over the entire process that I have some very kind users and also some users that have great ideas and points for improvements. They appreciate that the ability to give feedback and contribute often. I receive roughly 10 emails a day from my users with ideas and requests.</p>
<p><em>To Do Item(s):</em></p>
<ul>
<li>- Include your contact information somewhere</li>
</ul>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.unitedmindset.com%2Fjonbcampos%2F2010%2F12%2F28%2Flearn-from-my-mobile-mistakes%2F&amp;title=Learn%20from%20my%20mobile%20mistakes" id="wpa2a_10"><img src="http://www.unitedmindset.com/jonbcampos/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.unitedmindset.com/jonbcampos/2010/12/28/learn-from-my-mobile-mistakes/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Flex Mobile running on the Samsung Tablet</title>
		<link>http://www.unitedmindset.com/jonbcampos/2010/10/29/flex-mobile-running-on-the-samsung-tablet/</link>
		<comments>http://www.unitedmindset.com/jonbcampos/2010/10/29/flex-mobile-running-on-the-samsung-tablet/#comments</comments>
		<pubDate>Fri, 29 Oct 2010 20:19:21 +0000</pubDate>
		<dc:creator>jonbcampos</dc:creator>
				<category><![CDATA[Air for Android]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Netflix Flex API]]></category>
		<category><![CDATA[adobemax]]></category>
		<category><![CDATA[flex mobile]]></category>
		<category><![CDATA[samsung]]></category>

		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=2327</guid>
		<description><![CDATA[I created this app with Adobe&#8217;s Flex technology and Air for Android. I primarily test and develop on my Evo, but while at Adobe Max I was able to load my app onto the new Samsung Galaxy tablet. With 0 code changes the app just worked and looked really good. You can find the Queue [...]]]></description>
			<content:encoded><![CDATA[<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/FUBVOHsqqHE?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/FUBVOHsqqHE?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>
<p>I created this app with Adobe&#8217;s Flex technology and Air for Android. I primarily test and develop on my Evo, but while at Adobe Max I was able to load my app onto the new Samsung Galaxy tablet. With 0 code changes the app just worked and looked really good.</p>
<p>You can find the Queue Manager application in the Android Marketplace right now.<br />
<img src="http://qrcode.kaywa.com/img.php?s=5&#038;d=market%3A%2F%2Fsearch%3Fq%3Dpname%3Aair.com.unitedmindset.QueueManager" alt="qrcode"  /></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.unitedmindset.com%2Fjonbcampos%2F2010%2F10%2F29%2Fflex-mobile-running-on-the-samsung-tablet%2F&amp;title=Flex%20Mobile%20running%20on%20the%20Samsung%20Tablet" id="wpa2a_12"><img src="http://www.unitedmindset.com/jonbcampos/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.unitedmindset.com/jonbcampos/2010/10/29/flex-mobile-running-on-the-samsung-tablet/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Queue Manager</title>
		<link>http://www.unitedmindset.com/jonbcampos/2010/10/09/queue-manager/</link>
		<comments>http://www.unitedmindset.com/jonbcampos/2010/10/09/queue-manager/#comments</comments>
		<pubDate>Sat, 09 Oct 2010 20:16:20 +0000</pubDate>
		<dc:creator>jonbcampos</dc:creator>
				<category><![CDATA[Air for Android]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Netflix Flex API]]></category>
		<category><![CDATA[netflix]]></category>
		<category><![CDATA[queue manager]]></category>

		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=2236</guid>
		<description><![CDATA[If you are on of the 17000+ people that have downloaded and use my Queue Manager Android app I thank you. I am actively working to address each and every comment while continuing to add helpful features. If you are curious why I created this app then the answer is simple. I wanted to make [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-2237" title="icon128" src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2010/10/icon128.png" alt="" width="128" height="128" />If you are on of the 17000+ people that have downloaded and use my Queue Manager Android app I thank you. I am actively working to address each and every comment while continuing to add helpful features.</p>
<p>If you are curious why I created this app then the answer is simple. I wanted to make an easier way for me to manage my Netflix queue. I am a Netflix fanatic and am constantly working with my queue.</p>
<p><img src="http://qrcode.kaywa.com/img.php?s=5&amp;d=market%3A%2F%2Fsearch%3Fq%3Dpname%3Aair.com.unitedmindset.QueueManager" alt="qrcode" /></p>
<p><strong>Current State</strong><br />
If you are wondering if I feel the app is complete then the answer is NO! This is a work in progress and I hope you keep updating as I continue to make the app better. Right now I am trying to get through the bare minimum requirements, as I see them. Such as:<br />
- viewing queues<br />
- updating queues<br />
- add/remove/view movies<br />
- update movies queue positions</p>
<p><strong>Donation Link</strong><br />
Like this app? Feel all warm and fuzzy and would like to fund a developer for his hard work? Use this link:</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="encrypted" type="hidden" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBLYBzAZK0Wi+ZEHApa3KloegSUmwdl1qplh0FPAEAhpSoF+fBf9xeXhw8EcYFbUrbJOj/27ASJRU4YJmztfY9vY5GJ5lFcWJgt4PxzxQzgDctUxujdfM/wheHrCYp9IlKpENfO8CpapzPuGqxi1RHSCAroYCkN0nsMev/OlVRLEzELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIrBGO7w22H0yAgaAg2E0wz8cR29h4jxHuXFLewjOl9y8D9TU3HloCZ1z/89/+9wcvBHLtyBggb/NEJkJ/BLW4Szfzwl4+pfmYK1gyfJq/SZJCoiGpdg51uneHmqoyPz+08nP+S++CNwGxmckppEWOYXkQ6aa96u+Z2bnSpylu0mwbVjLKuQCKaHb2Eg/DDLR/ttBN5hRxTm5YxiAY4I0iK7OGb2CTnwZnaVVkoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTAxMjIwMjMxOTQyWjAjBgkqhkiG9w0BCQQxFgQU8o8LxT4gHPUAl5CZOC09+aqzm0wwDQYJKoZIhvcNAQEBBQAEgYA1YELnpgLdjM6pwWulvIRNA0CHxS5HJFy/pb9HxuDilvrPOTVkTH30rdy6dhdW92BiJ3AaLxkXuxpvemeubKwwhhyaXhm6cOJR5q9OnrbEWAg6hFLKjk+d0uz2ILQyT85VrhLXu5O89zLMBd9qhON5if4umWAbHIPGn3ewnc5dWw==-----END PKCS7-----&lt;br /&gt; " />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" /> <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /></form>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
</form>
<p><span id="more-2236"></span></p>
<p><strong>Planned updates</strong><br />
- Social connections<br />
- Gesture support<br />
- Search filtering<br />
- Bluray support</p>
<p><strong>Release Notes</strong><br />
I will keep this page going as a place for people to post comments and requests and a place for me to keep version update details. This way I can keep transparent as to my progress and you can see if your request is complete.</p>
<p><strong>v1.0.0 &#8211; Initial Release</strong><br />
Basic queue viewing</p>
<p><strong>v1.0.1 &#8211; Visual Change</strong><br />
-Updated browse to search as Netflix doesn&#8217;t provide category browse api</p>
<p><strong>v1.0.10 &#8211; Queue Change</strong><br />
- Paging added to Disc/Instant Queues<br />
- Updated Netflix API to allow Disc/Instant Queue Paging<br />
- Bug fixes<br />
- Loading bar added for visual feedback<br />
- Updated closing the app when backing out of Main Menu<br />
- Updated closing the app on logout</p>
<p><strong>v1.0.12 &#8211; New API Key Added</strong><br />
- Changed API key for higher daily rates</p>
<p><strong>v1.0.13 &#8211; Requests Fulfilled</strong><br />
- Menu closes when focus away from menu<br />
- Added Release Notes link in App Credits</p>
<p><strong>v1.0.14 &#8211; Performance Release</strong><br />
- Updated title load order<br />
- small noticeable performance increase<br />
- transitions are smoother</p>
<p><strong>v1.0.15 &#8211; Performance Release</strong><br />
- Reduced title calls by 1/5th.</p>
<p><strong>v1.0.20 &#8211; Queue Management Release</strong><br />
- Reorder Disc Queue<br />
- Reorder Instant Queue<br />
- Menus go away on option selection<br />
- Fixed Disc removal bug<br />
- Fixed Queue update bug</p>
<p><strong>v1.0.24 &#8211; Bug Release</strong><br />
- added opt-in error emails to me<br />
- quick rerun error calls<br />
- upped font sizes<br />
- added scrollers in some places</p>
<p><strong>v1.0.25 &#8211; Bug Release</strong><br />
- remove title bug fix</p>
<p><strong>v1.0.31 &#8211; Browsing Addition</strong><br />
- fixed add disc bug<br />
- added browsing support with subcategories</p>
<p><strong>v1.0.32 &#8211; Browsing Addition</strong><br />
- browse by genre from title details<br />
- browse similar titles from title details</p>
<p><strong>v1.0.33 &#8211; Bug Release</strong><br />
- null pointer error for missing directors/casts/etc now handled gracefully</p>
<p><strong>v1.0.36 &#8211; Bug Release</strong><br />
- working to fix specific user&#8217;s droid authentication issue<br />
- fixed bug with adding and removing sessions. Loading indicator remained even though service was complete.</p>
<p><strong>v1.0.37 &#8211; Visual Release</strong><br />
- moved paging buttons on screen, not behind menu<br />
- updated timestamp code<br />
- changed url encoding code</p>
<p><strong>v1.0.38</strong><br />
- bug fix &#8211; timestamp fix for authentication<br />
- visual fix &#8211; update to full lists not being visible<br />
- feature &#8211; browse now allows x levels<br />
- feature &#8211; added top level &#8220;new&#8221; dvd/instant/bluray<br />
- added tag showing this was made with Adobe Flex Technology</p>
<p><strong>v1.0.39  &#8211; Immediate Bug Fix</strong><br />
- fix &#8211; found null pointer error introduced in 1.0.31</p>
<p><strong>v1.1.0  &#8211; Horizontal Lists</strong><br />
- App2sd now available<br />
- Horizontal Lists<br />
- Format Availability in lists<br />
- Larger Coverart<br />
- Cleaned up loading and splash screens<br />
- Faster Login Process</p>
<p><strong>v1.1.1  &#8211; Bug Fixes</strong><br />
- Fixed front page misspelling &#8211; I&#8217;m not a writer, I&#8217;m a programer <img src='http://www.unitedmindset.com/jonbcampos/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
- Fixed browse bug that resets to first page on backing into titles list</p>
<p><strong>v1.1.3  &#8211; Bug Fixes</strong><br />
- Horizontal list search selection bug fix<br />
- architecture change (non-noticeable change)<br />
- error logging fix for email errors<br />
- instant/disc queue layout bug fix</p>
<p><strong>v1.1.4  &#8211; Additional Development</strong><br />
- Added additional fault checks<br />
- Fixed up main menu to be laid out a bit better <img src='http://www.unitedmindset.com/jonbcampos/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
- horizontal similars list<br />
- rearchitecture complete, all views simplified<br />
- if an instant title will be removed within 3 months, the list view will give you this warning of removal date</p>
<p><strong>v1.1.5  &#8211; Bug Fixes</strong><br />
- Performance fix for typing in search box<br />
- bug fix for switching layouts causing improper sizing<br />
- layout change for larger screens (tablet devices)<br />
- bug fix for empty horizontal lists</p>
<p><strong>v1.1.6  &#8211; Framework Upgrade</strong></p>
<p><strong>v1.1.7  &#8211; Bug Fix</strong><br />
- fixed bug stopping app from showing in the marketplace</p>
<p><strong>v1.1.8  &#8211; Bug Fix</strong><br />
- fixed multiword search bug</p>
<p><strong>v1.1.16</strong><br />
- fixing failed login issues<br />
- updated icons<br />
- bug fixes<br />
- performance fixes</p>
<p><strong>Donation Link</strong><br />
Like this app? Feel all warm and fuzzy and would like to fund a developer for his hard work? Use this link:</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="encrypted" type="hidden" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBLYBzAZK0Wi+ZEHApa3KloegSUmwdl1qplh0FPAEAhpSoF+fBf9xeXhw8EcYFbUrbJOj/27ASJRU4YJmztfY9vY5GJ5lFcWJgt4PxzxQzgDctUxujdfM/wheHrCYp9IlKpENfO8CpapzPuGqxi1RHSCAroYCkN0nsMev/OlVRLEzELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIrBGO7w22H0yAgaAg2E0wz8cR29h4jxHuXFLewjOl9y8D9TU3HloCZ1z/89/+9wcvBHLtyBggb/NEJkJ/BLW4Szfzwl4+pfmYK1gyfJq/SZJCoiGpdg51uneHmqoyPz+08nP+S++CNwGxmckppEWOYXkQ6aa96u+Z2bnSpylu0mwbVjLKuQCKaHb2Eg/DDLR/ttBN5hRxTm5YxiAY4I0iK7OGb2CTnwZnaVVkoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTAxMjIwMjMxOTQyWjAjBgkqhkiG9w0BCQQxFgQU8o8LxT4gHPUAl5CZOC09+aqzm0wwDQYJKoZIhvcNAQEBBQAEgYA1YELnpgLdjM6pwWulvIRNA0CHxS5HJFy/pb9HxuDilvrPOTVkTH30rdy6dhdW92BiJ3AaLxkXuxpvemeubKwwhhyaXhm6cOJR5q9OnrbEWAg6hFLKjk+d0uz2ILQyT85VrhLXu5O89zLMBd9qhON5if4umWAbHIPGn3ewnc5dWw==-----END PKCS7-----&lt;br /&gt; " />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" /> <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="" width="1" height="1" /><br />
</form>
<p><strong>Known Bugs</strong><br />
- Phones not releasing Oauth Tokens effecting Logout. This is due to a <a href="http://developer.netflix.com/forum/read/84179">Netflix logout bug</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.unitedmindset.com%2Fjonbcampos%2F2010%2F10%2F09%2Fqueue-manager%2F&amp;title=Queue%20Manager" id="wpa2a_14"><img src="http://www.unitedmindset.com/jonbcampos/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.unitedmindset.com/jonbcampos/2010/10/09/queue-manager/feed/</wfw:commentRss>
		<slash:comments>153</slash:comments>
		</item>
		<item>
		<title>Netflix API in Tour De Flex</title>
		<link>http://www.unitedmindset.com/jonbcampos/2010/01/30/netflix-api-in-tour-de-flex/</link>
		<comments>http://www.unitedmindset.com/jonbcampos/2010/01/30/netflix-api-in-tour-de-flex/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 17:09:23 +0000</pubDate>
		<dc:creator>jonbcampos</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Netflix Flex API]]></category>
		<category><![CDATA[netflix api]]></category>
		<category><![CDATA[tourdeflex]]></category>

		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=1288</guid>
		<description><![CDATA[Just quickly throwing this out. This week 2 examples of the Netflix AS3 API were added to Tour De Flex. These two examples show off some basic service calls and authentication. Hope this helps others if they are wanting to create an application with Netflix/Video information. Here on this blog you will see some more [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.adobe.com/devnet/flex/tourdeflex/web/"><img src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2010/01/Screen-shot-2010-01-28-at-11.48.23-PM.png" alt="tourdeflex" title="tourdeflex" width="400" height="308" class="size-full wp-image-1289" /></a></p>
<p>Just quickly throwing this out. This week 2 examples of the <a href="http://code.google.com/p/netflex-as3-api/">Netflix AS3 API</a> were added to <a href="http://www.adobe.com/devnet/flex/tourdeflex/web/">Tour De Flex</a>. These two examples show off some basic service calls and authentication. Hope this helps others if they are wanting to create an application with Netflix/Video information.<br />
<span id="more-1288"></span><br />
Here on this blog you will see some more examples coming shortly and hopefully a few working apps using different popular Flex frameworks. If you have any questions feel free to ask.</p>
<p><a href="http://gregsramblings.com/2010/01/27/netflix-actionscript-samples-added-to-tour-de-flex/"><img src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2010/01/netflix.jpg" alt="netflix" title="netflix" width="400" height="308" class="alignleft size-full wp-image-1300" /></a><br />
You can also see the <a href="http://gregsramblings.com/2010/01/27/netflix-actionscript-samples-added-to-tour-de-flex/">announcement here</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.unitedmindset.com%2Fjonbcampos%2F2010%2F01%2F30%2Fnetflix-api-in-tour-de-flex%2F&amp;title=Netflix%20API%20in%20Tour%20De%20Flex" id="wpa2a_16"><img src="http://www.unitedmindset.com/jonbcampos/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.unitedmindset.com/jonbcampos/2010/01/30/netflix-api-in-tour-de-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Netflix API with PureMVC</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/07/27/netflix-api-with-puremvc/</link>
		<comments>http://www.unitedmindset.com/jonbcampos/2009/07/27/netflix-api-with-puremvc/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 09:50:54 +0000</pubDate>
		<dc:creator>jonbcampos</dc:creator>
				<category><![CDATA[Netflix Flex API]]></category>
		<category><![CDATA[netflix api]]></category>
		<category><![CDATA[netflix library]]></category>
		<category><![CDATA[puremvc]]></category>

		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=446</guid>
		<description><![CDATA[PureMVC is another Actionscript heavy Flex framework that explicitly sends messages or &#8216;notifications&#8217; around the framework to alert the application of changes, this is very different from Mate and Cairngorm that rely on data binding to update data within the application. What many people love about the PureMVC is the massive amount of delineation built [...]]]></description>
			<content:encoded><![CDATA[<p>PureMVC is another Actionscript heavy Flex framework that explicitly sends messages or &#8216;notifications&#8217; around the framework to alert the application of changes, this is very different from Mate and Cairngorm that rely on data binding to update data within the application. What many people love about the PureMVC is the massive amount of delineation built into the framework &#8211; this helps modularize parts of your application. Along with the delineation people love the event/notification system, it&#8217;s like the Flex event system ON CRACK.</p>
<p>Let&#8217;s put it together.<br />
<span id="more-446"></span></p>
<p><strong>The View</strong><br />
As with each of these framework examples I start with the same exact view.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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>s:Application xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span><br />
&nbsp; &nbsp; xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span><br />
&nbsp; &nbsp; xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>fx: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;">controls</span>.<span style="color: #006600;">Alert</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">FlexEvent</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">FormUtil</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> spark.<span style="color: #006600;">events</span>.<span style="color: #006600;">TextOperationEvent</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> requestTokenButton_clickHandler<span style="color: #66cc66;">&#40;</span>event:MouseEvent<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> a:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span>consumerKeyV,consumerSecretV<span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FormUtil.<span style="color: #006600;">formValidation</span><span style="color: #66cc66;">&#40;</span>a,actuallyRequestToken<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> actuallyRequestToken<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; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> requestAccessTokenButton_clickHandler<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// TODO Auto-generated method stub</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> textinput1_changeHandler<span style="color: #66cc66;">&#40;</span>event:TextOperationEvent<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> textInput:TextInput = event.<span style="color: #0066CC;">target</span> as TextInput;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>textInput.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">length</span>==<span style="color: #cc66cc;">0</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: #808080; font-style: italic;">//empty</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: #808080; font-style: italic;">//run</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>fx:Script<span style="color: #66cc66;">&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:layout<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:HorizontalLayout paddingBottom=<span style="color: #ff0000;">&quot;20&quot;</span> paddingLeft=<span style="color: #ff0000;">&quot;20&quot;</span> paddingRight=<span style="color: #ff0000;">&quot;20&quot;</span> paddingTop=<span style="color: #ff0000;">&quot;20&quot;</span> gap=<span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:layout<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>fx:Declarations<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span>--validations--<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:StringValidator id=<span style="color: #ff0000;">&quot;consumerKeyV&quot;</span> source=<span style="color: #ff0000;">&quot;{consumerKeyInput}&quot;</span> property=<span style="color: #ff0000;">&quot;text&quot;</span> minLength=<span style="color: #ff0000;">&quot;24&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:StringValidator id=<span style="color: #ff0000;">&quot;consumerSecretV&quot;</span> source=<span style="color: #ff0000;">&quot;{consumerSecretInput}&quot;</span> property=<span style="color: #ff0000;">&quot;text&quot;</span> minLength=<span style="color: #ff0000;">&quot;10&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>fx:Declarations<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Form<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormHeading label=<span style="color: #ff0000;">&quot;Netflix Keys&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormItem label=<span style="color: #ff0000;">&quot;Consumer Key&quot;</span> required=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:TextInput id=<span style="color: #ff0000;">&quot;consumerKeyInput&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormItem label=<span style="color: #ff0000;">&quot;Consumer Secret&quot;</span> required=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:TextInput id=<span style="color: #ff0000;">&quot;consumerSecretInput&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:<span style="color: #0066CC;">Button</span> label=<span style="color: #ff0000;">&quot;Request Token&quot;</span> id=<span style="color: #ff0000;">&quot;requestTokenButton&quot;</span> click=<span style="color: #ff0000;">&quot;requestTokenButton_clickHandler(event)&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormHeading label=<span style="color: #ff0000;">&quot;Netflix Access Token&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:<span style="color: #0066CC;">Button</span> label=<span style="color: #ff0000;">&quot;Request Access Token&quot;</span> id=<span style="color: #ff0000;">&quot;requestAccessTokenButton&quot;</span> click=<span style="color: #ff0000;">&quot;requestAccessTokenButton_clickHandler(event)&quot;</span> <span style="color: #0066CC;">enabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:Form<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:VGroup <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; <span style="color: #66cc66;">&lt;</span>s:HGroup <span style="color: #0066CC;">width</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>mx:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Search Catalog&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:TextInput change=<span style="color: #ff0000;">&quot;textinput1_changeHandler(event)&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:HGroup<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:<span style="color: #0066CC;">List</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> labelField=<span style="color: #ff0000;">&quot;title&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:VGroup<span style="color: #66cc66;">&gt;</span><br />
<span style="color: #66cc66;">&lt;/</span>s:Application<span style="color: #66cc66;">&gt;</span></div></div>
<p>Which produces&#8230;<br />
<div id="attachment_500" class="wp-caption alignnone" style="width: 310px"><a href="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/Picture-22-300x193.png"><img src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/Picture-22-300x193.png" alt="PureMVC Application" title="Quick App" width="300" height="193" class="size-medium wp-image-500" /></a><p class="wp-caption-text">PureMVC Application</p></div></p>
<p><strong>Time to start those engines&#8230; soon</strong><br />
One bit of annoyance that I have with PureMVC is the MASSIVE amount setup, basically we have to build the engine before we can start the car&#8230; a large complex engine. So let&#8217;s start building&#8230;</p>
<p><strong>The Application Facade</strong><br />
The Application Facade is your starting point and main singleton object that is your connection to all of your models and mediators. As important as this sounds the Application Facade is actually a very simple starting point and it&#8217;s main job is to start up the application. My Application Facade is as follows:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">facade</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">macro</span>.<span style="color: #006600;">ApplicationStartupCommand</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">patterns</span>.<span style="color: #006600;">facade</span>.<span style="color: #006600;">Facade</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ApplicationFacade <span style="color: #0066CC;">extends</span> Facade<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> ApplicationFacade<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; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> getInstance<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:ApplicationFacade<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>instance==<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; instance = <span style="color: #000000; font-weight: bold;">new</span> ApplicationFacade<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> instance as ApplicationFacade;<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> initializeController<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;">initializeController</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; registerCommand<span style="color: #66cc66;">&#40;</span>ApplicationNotifications.<span style="color: #006600;">STARTUP</span>,ApplicationStartupCommand<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> startup<span style="color: #66cc66;">&#40;</span>app:NetflixPureMVC<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; sendNotification<span style="color: #66cc66;">&#40;</span>ApplicationNotifications.<span style="color: #006600;">STARTUP</span>,app<span style="color: #66cc66;">&#41;</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></div>
<p>As you can see the Application Facade registers the startup command and waits for the startup function to be called. The real magic is what happens when this startup command is called, the entire application comes to life, the listeners are all registered, proxies are created, and the view is prepped for user interaction.  How does this work exactly?<br />
<div id="attachment_598" class="wp-caption alignnone" style="width: 435px"><a href="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/applicationStartup.png"><img src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/applicationStartup.png" alt="Application StartUp Diagram" title="applicationStartup" width="425" height="385" class="size-full wp-image-598" /></a><p class="wp-caption-text">Application StartUp Diagram</p></div><br />
The diagram lays out the different parts that are created and registered on startup, the code for each part is featured below.</p>
<p><em>Application Startup Command</em></p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">macro</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">simple</span>.<span style="color: #006600;">ModelPrepCommand</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">simple</span>.<span style="color: #006600;">ViewPrepCommand</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">patterns</span>.<span style="color: #006600;">command</span>.<span style="color: #006600;">MacroCommand</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ApplicationStartupCommand <span style="color: #0066CC;">extends</span> MacroCommand<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> ApplicationStartupCommand<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; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; override protected <span style="color: #000000; font-weight: bold;">function</span> initializeMacroCommand<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;">//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addSubCommand<span style="color: #66cc66;">&#40;</span> ModelPrepCommand <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addSubCommand<span style="color: #66cc66;">&#40;</span> ViewPrepCommand <span style="color: #66cc66;">&#41;</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></div>
<p><em>Model Prep Command</em></p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">simple</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">proxy</span>.<span style="color: #006600;">AccessProxy</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">proxy</span>.<span style="color: #006600;">AccessTokenProxy</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">proxy</span>.<span style="color: #006600;">AutocompleteProxy</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">INotification</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">patterns</span>.<span style="color: #006600;">command</span>.<span style="color: #006600;">SimpleCommand</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ModelPrepCommand <span style="color: #0066CC;">extends</span> SimpleCommand<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> ModelPrepCommand<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; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> execute<span style="color: #66cc66;">&#40;</span>notification:INotification<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;">//register proxys</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; facade.<span style="color: #006600;">registerProxy</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> AutocompleteProxy<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; facade.<span style="color: #006600;">registerProxy</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> AccessProxy<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; facade.<span style="color: #006600;">registerProxy</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> AccessTokenProxy<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</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></div>
<p><em>View Prep Command</em></p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">simple</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">mediator</span>.<span style="color: #006600;">ApplicationMediator</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">INotification</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">patterns</span>.<span style="color: #006600;">command</span>.<span style="color: #006600;">SimpleCommand</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ViewPrepCommand <span style="color: #0066CC;">extends</span> SimpleCommand<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> ViewPrepCommand<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; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> execute<span style="color: #66cc66;">&#40;</span>notification:INotification<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;">//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; facade.<span style="color: #006600;">registerMediator</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> ApplicationMediator<span style="color: #66cc66;">&#40;</span> notification.<span style="color: #006600;">getBody</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</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></div>
<p><strong>Views and Mediators</strong><br />
What is interesting about PureMVC is how the view is disconnected from the machine itself and run via events sent to mediators. Mediators hold references to the views that they control, sends/receives notifications from the rest of the application, and finally listens for events from their connected view to send notifications and execute methods. This separation of view and controller is paramount to proper MVC development and keeps your views clean of logic.</p>
<p>When putting together your mediators it is easiest if you keep to a process for the layout of your mediator.<br />
<div id="attachment_603" class="wp-caption alignnone" style="width: 535px"><a href="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/Picture-9.png"><img src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/Picture-9.png" alt="1. Create your Mediator Class" title="Create your Mediator Class" width="525" height="488" class="size-full wp-image-603" /></a><p class="wp-caption-text">1. Create your Mediator Class</p></div></p>
<p>This will create:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">mediator</span><br />
<span style="color: #66cc66;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IMediator</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">INotification</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">patterns</span>.<span style="color: #006600;">mediator</span>.<span style="color: #006600;">Mediator</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ApplicationMediator <span style="color: #0066CC;">extends</span> Mediator <span style="color: #0066CC;">implements</span> IMediator<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ApplicationMediator<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>:<span style="color: #0066CC;">String</span>, viewComponent:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">null</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: #0066CC;">name</span>, viewComponent<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> listNotificationInterests<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: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> handleNotification<span style="color: #66cc66;">&#40;</span>notification:INotification<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; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>Honestly, there are many other functions that are created, but these are the basic ones that you need to get going.</p>
<p>2. Next, name your mediator by adding a constant variable that we typically label &#8220;NAME&#8221;.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">NAME</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;ApplicationMediator&quot;</span>;</div></div>
<p>3. Add in local references to proxies that this mediator will need access to&#8230;</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">...<br />
<span style="color: #808080; font-style: italic;">//proxys</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> autocompleteProxy:AutocompleteProxy;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> accessProxy:AccessProxy;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> accessTokenProxy:AccessTokenProxy;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ApplicationMediator<span style="color: #66cc66;">&#40;</span>viewComponent:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">null</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: #0066CC;">NAME</span>, viewComponent<span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; autocompleteProxy = facade.<span style="color: #006600;">retrieveProxy</span><span style="color: #66cc66;">&#40;</span> AutocompleteProxy.<span style="color: #0066CC;">NAME</span> <span style="color: #66cc66;">&#41;</span> as AutocompleteProxy;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accessProxy = facade.<span style="color: #006600;">retrieveProxy</span><span style="color: #66cc66;">&#40;</span> AccessProxy.<span style="color: #0066CC;">NAME</span> <span style="color: #66cc66;">&#41;</span> as AccessProxy;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accessTokenProxy = facade.<span style="color: #006600;">retrieveProxy</span><span style="color: #66cc66;">&#40;</span> AccessTokenProxy.<span style="color: #0066CC;">NAME</span> <span style="color: #66cc66;">&#41;</span> as AccessTokenProxy;<br />
...</div></div>
<p>Then add notifications that the mediator has interest in&#8230;</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> listNotificationInterests<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: #b1b100;">return</span> <span style="color: #66cc66;">&#91;</span>ApplicationNotifications.<span style="color: #006600;">LOAD_AUTOCOMPLETE_LIST_SUCCESS</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">LOAD_AUTOCOMPLETE_LIST_FAILED</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">REQUEST_TOKEN</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">REQUEST_ACCESS_TOKEN</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">REQUEST_AUTOCOMPLETE_LIST</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">LOAD_ACCESS_TOKEN_SUCCESS</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">LOAD_ACCESS_TOKEN_FAILED</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">LOAD_TOKEN_SUCCESS</span><span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></div>
<p>Next add in some code to handle the notifications that the mediator is listening to&#8230;</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">...<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600;">override</span> <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> handleNotification<span style="color: #66cc66;">&#40;</span>notification:INotification<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;">switch</span><span style="color: #66cc66;">&#40;</span> notification.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</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: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">LOAD_AUTOCOMPLETE_LIST_SUCCESS</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">LOAD_AUTOCOMPLETE_LIST_FAILED</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">REQUEST_TOKEN</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">REQUEST_ACCESS_TOKEN</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">REQUEST_AUTOCOMPLETE_LIST</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">LOAD_ACCESS_TOKEN_SUCCESS</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">LOAD_TOKEN_SUCCESS</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</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 />
...</div></div>
<p>The rest of the code that you need to add will be the listeners and methods needed to run the view. You can view my final Application Mediator. This mediator controls the main Application view file. You will see that I prefer to have references to my view&#8217;s components as getters in my mediator.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">mediator</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">facade</span>.<span style="color: #006600;">ApplicationNotifications</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">proxy</span>.<span style="color: #006600;">AccessProxy</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">proxy</span>.<span style="color: #006600;">AccessTokenProxy</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">proxy</span>.<span style="color: #006600;">AutocompleteProxy</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IMediator</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">INotification</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">patterns</span>.<span style="color: #006600;">mediator</span>.<span style="color: #006600;">Mediator</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> spark.<span style="color: #006600;">components</span>.<span style="color: #0066CC;">Button</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> spark.<span style="color: #006600;">components</span>.<span style="color: #0066CC;">List</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> spark.<span style="color: #006600;">components</span>.<span style="color: #006600;">TextInput</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ApplicationMediator <span style="color: #0066CC;">extends</span> Mediator <span style="color: #0066CC;">implements</span> IMediator<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">NAME</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;ApplicationMediator&quot;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//proxys</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> autocompleteProxy:AutocompleteProxy;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> accessProxy:AccessProxy;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> accessTokenProxy:AccessTokenProxy;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ApplicationMediator<span style="color: #66cc66;">&#40;</span>viewComponent:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">null</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: #0066CC;">NAME</span>, viewComponent<span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; autocompleteProxy = facade.<span style="color: #006600;">retrieveProxy</span><span style="color: #66cc66;">&#40;</span> AutocompleteProxy.<span style="color: #0066CC;">NAME</span> <span style="color: #66cc66;">&#41;</span> as AutocompleteProxy;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accessProxy = facade.<span style="color: #006600;">retrieveProxy</span><span style="color: #66cc66;">&#40;</span> AccessProxy.<span style="color: #0066CC;">NAME</span> <span style="color: #66cc66;">&#41;</span> as AccessProxy;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accessTokenProxy = facade.<span style="color: #006600;">retrieveProxy</span><span style="color: #66cc66;">&#40;</span> AccessTokenProxy.<span style="color: #0066CC;">NAME</span> <span style="color: #66cc66;">&#41;</span> as AccessTokenProxy;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; app.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> NetflixPureMVC.<span style="color: #006600;">REQUEST_TOKEN</span>, requestToken_Handler <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; app.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> NetflixPureMVC.<span style="color: #006600;">REQUEST_ACCESS_TOKEN</span>, requestAccessToken_Handler <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; app.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> NetflixPureMVC.<span style="color: #006600;">TEXT_INPUT_CHANGE</span>, textInputChange_Handler <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> listNotificationInterests<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: #b1b100;">return</span> <span style="color: #66cc66;">&#91;</span>ApplicationNotifications.<span style="color: #006600;">LOAD_AUTOCOMPLETE_LIST_SUCCESS</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">LOAD_AUTOCOMPLETE_LIST_FAILED</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">REQUEST_TOKEN</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">REQUEST_ACCESS_TOKEN</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">REQUEST_AUTOCOMPLETE_LIST</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">LOAD_ACCESS_TOKEN_SUCCESS</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">LOAD_ACCESS_TOKEN_FAILED</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ApplicationNotifications.<span style="color: #006600;">LOAD_TOKEN_SUCCESS</span><span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> handleNotification<span style="color: #66cc66;">&#40;</span>notification:INotification<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;">switch</span><span style="color: #66cc66;">&#40;</span> notification.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</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: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">LOAD_AUTOCOMPLETE_LIST_SUCCESS</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">LOAD_AUTOCOMPLETE_LIST_FAILED</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">list</span>.<span style="color: #006600;">dataProvider</span> = autocompleteProxy.<span style="color: #006600;">autocompleteListDP</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">REQUEST_TOKEN</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accessProxy.<span style="color: #006600;">requestToken</span><span style="color: #66cc66;">&#40;</span>consumerKeyInput.<span style="color: #0066CC;">text</span>, consumerSecretInput.<span style="color: #0066CC;">text</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">REQUEST_ACCESS_TOKEN</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accessTokenProxy.<span style="color: #006600;">requestAccessToken</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">REQUEST_AUTOCOMPLETE_LIST</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; autocompleteProxy.<span style="color: #006600;">loadAutocompleteList</span><span style="color: #66cc66;">&#40;</span> textInput.<span style="color: #0066CC;">text</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">LOAD_ACCESS_TOKEN_SUCCESS</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textInput.<span style="color: #0066CC;">enabled</span> = <span style="color: #000000; font-weight: bold;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> ApplicationNotifications.<span style="color: #006600;">LOAD_TOKEN_SUCCESS</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; requestAccessTokenButton.<span style="color: #0066CC;">enabled</span> = <span style="color: #000000; font-weight: bold;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</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;">//----------------------</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// View Component References</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//----------------------</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> app<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:NetflixPureMVC<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> viewComponent as NetflixPureMVC;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> textInput<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:TextInput<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> app.<span style="color: #006600;">autocompleteTextInput</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> <span style="color: #0066CC;">list</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">List</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> app.<span style="color: #0066CC;">list</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> consumerKeyInput<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:TextInput<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> app.<span style="color: #006600;">consumerKeyInput</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> consumerSecretInput<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:TextInput<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> app.<span style="color: #006600;">consumerSecretInput</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> requestTokenButton<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Button</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> app.<span style="color: #006600;">requestTokenButton</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> requestAccessTokenButton<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Button</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> app.<span style="color: #006600;">requestAccessTokenButton</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;">//----------------------</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Methods</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//----------------------</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> requestAccessToken_Handler<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; sendNotification<span style="color: #66cc66;">&#40;</span> ApplicationNotifications.<span style="color: #006600;">REQUEST_ACCESS_TOKEN</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> requestToken_Handler<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; sendNotification<span style="color: #66cc66;">&#40;</span> ApplicationNotifications.<span style="color: #006600;">REQUEST_TOKEN</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> textInputChange_Handler<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; sendNotification<span style="color: #66cc66;">&#40;</span> ApplicationNotifications.<span style="color: #006600;">REQUEST_AUTOCOMPLETE_LIST</span> <span style="color: #66cc66;">&#41;</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></div>
<blockquote><p>Remember on of the main principals of application development: KISS. Mediators usually keep a 1 to 1 ratio with views, so when you are naming your mediators keep your view&#8217;s name in the mediator, this will keep it easy to see which mediators are attached to which view. Example: <em>Application.mxml</em> :: <em>ApplicationMediator.as</em>
</p></blockquote>
<p><strong>Proxies</strong><br />
Proxies are your data centers of the application and act as stand ins for your data. This is really nice because you won&#8217;t have the issue of data not being available, causing wonderful runtime &#8220;null&#8221; pointer errors.</p>
<p>Again, let&#8217;s follow a process and put together our proxy.<br />
<div id="attachment_609" class="wp-caption alignnone" style="width: 534px"><a href="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/Picture-10.png"><img src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/Picture-10.png" alt="1. Create the class" title="Create the class" width="524" height="488" class="size-full wp-image-609" /></a><p class="wp-caption-text">1. Create the class</p></div></p>
<p>This proxy we are setting up to handle a service call, that is why we included the IResponder interface (which provides us access to the result and fault methods). We also make sure to name our proxy with a NAME constant so we can access it later through the retrieveProxy method. Our current class looks as follows:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">proxy</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">IResponder</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IProxy</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">patterns</span>.<span style="color: #006600;">proxy</span>.<span style="color: #006600;">Proxy</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AutocompleteProxy <span style="color: #0066CC;">extends</span> Proxy <span style="color: #0066CC;">implements</span> IProxy, IResponder<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">NAME</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;AutocompleteProxy&quot;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> AutocompleteProxy<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">data</span>:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">null</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: #0066CC;">NAME</span>, <span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> result<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;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> fault<span style="color: #66cc66;">&#40;</span>info:<span style="color: #0066CC;">Object</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 />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>Our proxy will need a method to call the service and a getter to retrieve access to the proxy&#8217;s data. Our changed proxy looks as follows:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">proxy</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">IResponder</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IProxy</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">patterns</span>.<span style="color: #006600;">proxy</span>.<span style="color: #006600;">Proxy</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AutocompleteProxy <span style="color: #0066CC;">extends</span> Proxy <span style="color: #0066CC;">implements</span> IProxy, IResponder<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">NAME</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;AutocompleteProxy&quot;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> AutocompleteProxy<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">data</span>:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">null</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: #0066CC;">NAME</span>, <span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> loadAutocompleteList<span style="color: #66cc66;">&#40;</span>term:<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 />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> result<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;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> fault<span style="color: #66cc66;">&#40;</span>info:<span style="color: #0066CC;">Object</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 />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<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> autocompleteListDP<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:ArrayCollection<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">null</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></div>
<p>To complete the proxy we need to add in a delegate (more on delegates next) to actually make the service call in the load method, then add in the logic for our result/fault methods, and finally return the data in the data getter function. One thing to remember is that proxies include a data property to actually store the data that the proxy represents, so when you retrieve/set/access data, store that data in your proxy&#8217;s data property. Finally send out notifications to our engine that lets the rest of the application know that our service has received a result/fault.</p>
<p>The final proxy is here.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">proxy</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">NetflixFaultEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">NetflixResultEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">facade</span>.<span style="color: #006600;">ApplicationNotifications</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">business</span>.<span style="color: #006600;">AutocompleteDelegate</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">collections</span>.<span style="color: #006600;">ArrayCollection</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">Alert</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">IResponder</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">interfaces</span>.<span style="color: #006600;">IProxy</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">puremvc</span>.<span style="color: #006600;">as3</span>.<span style="color: #006600;">patterns</span>.<span style="color: #006600;">proxy</span>.<span style="color: #006600;">Proxy</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AutocompleteProxy <span style="color: #0066CC;">extends</span> Proxy <span style="color: #0066CC;">implements</span> IProxy, IResponder<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">NAME</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;AutocompleteProxy&quot;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> AutocompleteProxy<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">data</span>:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">null</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: #0066CC;">NAME</span>, <span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> loadAutocompleteList<span style="color: #66cc66;">&#40;</span>term:<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: #000000; font-weight: bold;">var</span> delegate:AutocompleteDelegate = <span style="color: #000000; font-weight: bold;">new</span> AutocompleteDelegate<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delegate.<span style="color: #006600;">getAutocompleteList</span><span style="color: #66cc66;">&#40;</span>term<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> result<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;">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> result:NetflixResultEvent = <span style="color: #0066CC;">data</span> as NetflixResultEvent;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">data</span> = <span style="color: #000000; font-weight: bold;">new</span> ArrayCollection<span style="color: #66cc66;">&#40;</span>result.<span style="color: #006600;">result</span> as <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendNotification<span style="color: #66cc66;">&#40;</span> ApplicationNotifications.<span style="color: #006600;">LOAD_AUTOCOMPLETE_LIST_SUCCESS</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> fault<span style="color: #66cc66;">&#40;</span>info:<span style="color: #0066CC;">Object</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;">this</span>.<span style="color: #0066CC;">data</span> = <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; <span style="color: #000000; font-weight: bold;">var</span> fault:NetflixFaultEvent = info as NetflixFaultEvent;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Error occured while calling for autocomplete service.&quot;</span>,<span style="color: #ff0000;">&quot;System Alert&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendNotification<span style="color: #66cc66;">&#40;</span> ApplicationNotifications.<span style="color: #006600;">LOAD_AUTOCOMPLETE_LIST_FAILED</span> <span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<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> autocompleteListDP<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:ArrayCollection<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">data</span> as ArrayCollection;<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></div>
<p><strong>Our Service Connection, the Delegate</strong><br />
Delegates are simple classes that hold a reference to the responder class that they will respond to (that is why our proxy implements the IResponder interface), a service reference, and methods that will actually connect with the service. Below is my <em>AutocompleteDelegate</em>. Usually I try to keep one delegate per service. Many services will include multiple methods, so my delegate will have one method per service method. Some people also like to have one delegate per service method, the choice is yours.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">model</span>.<span style="color: #006600;">business</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">catalog</span>.<span style="color: #006600;">TitlesService</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">catalog</span>.<span style="color: #006600;">params</span>.<span style="color: #006600;">CatalogParams</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">NetflixFaultEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">NetflixResultEvent</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">IResponder</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AutocompleteDelegate<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> _responder:IResponder;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _service:TitlesService;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> AutocompleteDelegate<span style="color: #66cc66;">&#40;</span>responder:IResponder<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _service = <span style="color: #000000; font-weight: bold;">new</span> TitlesService<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _responder = responder;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getAutocompleteList<span style="color: #66cc66;">&#40;</span>term:<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; _service.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>NetflixResultEvent.<span style="color: #006600;">RESULT</span>,_responder.<span style="color: #006600;">result</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _service.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>NetflixFaultEvent.<span style="color: #006600;">FAULT</span>,_responder.<span style="color: #006600;">fault</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> params:CatalogParams = <span style="color: #000000; font-weight: bold;">new</span> CatalogParams<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; params.<span style="color: #006600;">term</span> = term;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _service.<span style="color: #006600;">autoCompleteService</span><span style="color: #66cc66;">&#40;</span>params<span style="color: #66cc66;">&#41;</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></div>
<p><strong>Back to the view</strong><br />
We have now outlined all the parts to the PureMVC framework setup, now we just need to see how the view connects to your new beautiful machine.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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>s:Application xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span><br />
&nbsp; &nbsp; xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span><br />
&nbsp; &nbsp; xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><br />
&nbsp; &nbsp; creationComplete=<span style="color: #ff0000;">&quot;application1_creationCompleteHandler(event)&quot;</span> viewSourceURL=<span style="color: #ff0000;">&quot;srcview/index.html&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>fx: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;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">facade</span>.<span style="color: #006600;">ApplicationNotifications</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">controller</span>.<span style="color: #006600;">facade</span>.<span style="color: #006600;">ApplicationFacade</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">FlexEvent</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">FormUtil</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">import</span> spark.<span style="color: #006600;">events</span>.<span style="color: #006600;">TextOperationEvent</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const TEXT_INPUT_CHANGE:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;textInputChange&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const REQUEST_TOKEN:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;requestToken&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> const REQUEST_ACCESS_TOKEN:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;requestAccessToken&quot;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> application1_creationCompleteHandler<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; &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> facade:ApplicationFacade = ApplicationFacade.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; facade.<span style="color: #006600;">startup</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> requestTokenButton_clickHandler<span style="color: #66cc66;">&#40;</span>event:MouseEvent<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> a:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span>consumerKeyV,consumerSecretV<span style="color: #66cc66;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FormUtil.<span style="color: #006600;">formValidation</span><span style="color: #66cc66;">&#40;</span>a,actuallyRequestToken<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> actuallyRequestToken<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; dispatchEvent<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span> REQUEST_TOKEN <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 />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> requestAccessTokenButton_clickHandler<span style="color: #66cc66;">&#40;</span>event:MouseEvent<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; dispatchEvent<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span> REQUEST_ACCESS_TOKEN <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 />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; protected <span style="color: #000000; font-weight: bold;">function</span> textinput1_changeHandler<span style="color: #66cc66;">&#40;</span>event:TextOperationEvent<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> textInput:TextInput = event.<span style="color: #0066CC;">target</span> as TextInput;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>textInput.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">length</span>==<span style="color: #cc66cc;">0</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: #808080; font-style: italic;">//empty</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; dispatchEvent<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span> TEXT_INPUT_CHANGE <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 />
<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>fx:Script<span style="color: #66cc66;">&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:layout<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:HorizontalLayout paddingBottom=<span style="color: #ff0000;">&quot;20&quot;</span> paddingLeft=<span style="color: #ff0000;">&quot;20&quot;</span> paddingRight=<span style="color: #ff0000;">&quot;20&quot;</span> paddingTop=<span style="color: #ff0000;">&quot;20&quot;</span> gap=<span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:layout<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>fx:Declarations<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span>--validations--<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:StringValidator id=<span style="color: #ff0000;">&quot;consumerKeyV&quot;</span> source=<span style="color: #ff0000;">&quot;{consumerKeyInput}&quot;</span> property=<span style="color: #ff0000;">&quot;text&quot;</span> minLength=<span style="color: #ff0000;">&quot;24&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:StringValidator id=<span style="color: #ff0000;">&quot;consumerSecretV&quot;</span> source=<span style="color: #ff0000;">&quot;{consumerSecretInput}&quot;</span> property=<span style="color: #ff0000;">&quot;text&quot;</span> minLength=<span style="color: #ff0000;">&quot;10&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>fx:Declarations<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:Form<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormHeading label=<span style="color: #ff0000;">&quot;Netflix Keys&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormItem label=<span style="color: #ff0000;">&quot;Consumer Key&quot;</span> required=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:TextInput id=<span style="color: #ff0000;">&quot;consumerKeyInput&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormItem label=<span style="color: #ff0000;">&quot;Consumer Secret&quot;</span> required=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:TextInput id=<span style="color: #ff0000;">&quot;consumerSecretInput&quot;</span> <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:<span style="color: #0066CC;">Button</span> label=<span style="color: #ff0000;">&quot;Request Token&quot;</span> id=<span style="color: #ff0000;">&quot;requestTokenButton&quot;</span> click=<span style="color: #ff0000;">&quot;requestTokenButton_clickHandler(event)&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormHeading label=<span style="color: #ff0000;">&quot;Netflix Access Token&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:<span style="color: #0066CC;">Button</span> label=<span style="color: #ff0000;">&quot;Request Access Token&quot;</span> id=<span style="color: #ff0000;">&quot;requestAccessTokenButton&quot;</span> <span style="color: #0066CC;">enabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span> click=<span style="color: #ff0000;">&quot;requestAccessTokenButton_clickHandler(event)&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:FormItem<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:Form<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:VGroup <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; <span style="color: #66cc66;">&lt;</span>s:HGroup <span style="color: #0066CC;">width</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>mx:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Search Catalog&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:TextInput change=<span style="color: #ff0000;">&quot;textinput1_changeHandler(event)&quot;</span> id=<span style="color: #ff0000;">&quot;autocompleteTextInput&quot;</span> <span style="color: #0066CC;">enabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:HGroup<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:<span style="color: #0066CC;">List</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> labelField=<span style="color: #ff0000;">&quot;title&quot;</span> id=<span style="color: #ff0000;">&quot;list&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:VGroup<span style="color: #66cc66;">&gt;</span><br />
<span style="color: #66cc66;">&lt;/</span>s:Application<span style="color: #66cc66;">&gt;</span></div></div>
<p><strong>Start your engines!</strong><br />
Now when your application starts up the framework is waiting for one command to get going:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">facade.<span style="color: #006600;">startup</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#41;</span>;</div></div>
<p>With this startup method called your engine is running and you are ready to go!</p>
<p><strong>Final Application</strong><br />
<a href="http://unitedmindset.com/jonbcampos/wp-content/flex_content/netflix_examples/puremvc/NetflixPureMVC.html">This is the final PureMVC Example and the source.</a><br />
<div id="attachment_500" class="wp-caption alignnone" style="width: 310px"><a href="http://unitedmindset.com/jonbcampos/wp-content/flex_content/netflix_examples/puremvc/NetflixPureMVC.html"><img src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/Picture-22-300x193.png" alt="PureMVC Application" title="Quick App" width="300" height="193" class="size-medium wp-image-500" /></a><p class="wp-caption-text">PureMVC Application</p></div></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.unitedmindset.com%2Fjonbcampos%2F2009%2F07%2F27%2Fnetflix-api-with-puremvc%2F&amp;title=Netflix%20API%20with%20PureMVC" id="wpa2a_18"><img src="http://www.unitedmindset.com/jonbcampos/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.unitedmindset.com/jonbcampos/2009/07/27/netflix-api-with-puremvc/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Netflix API with Mate</title>
		<link>http://www.unitedmindset.com/jonbcampos/2009/07/01/netflix-api-with-mate/</link>
		<comments>http://www.unitedmindset.com/jonbcampos/2009/07/01/netflix-api-with-mate/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 11:00:57 +0000</pubDate>
		<dc:creator>jonbcampos</dc:creator>
				<category><![CDATA[Netflix Flex API]]></category>
		<category><![CDATA[mate]]></category>
		<category><![CDATA[netflix api]]></category>
		<category><![CDATA[netflix library]]></category>

		<guid isPermaLink="false">http://unitedmindset.com/jonbcampos/?p=444</guid>
		<description><![CDATA[When I created this post Flex 4 and Mate didn&#8217;t play nice together. Because of that I wasn&#8217;t able to create my example app in Flex 4 like my last Flex 4 Cairngorm App example. Sadly I am having to downgrade this example to the currently working Flex 3 &#8211; though I intend to upgrade [...]]]></description>
			<content:encoded><![CDATA[<p>When I created this post Flex 4 and Mate didn&#8217;t play nice together. Because of that I wasn&#8217;t able to create my example app in Flex 4 like my last Flex 4 Cairngorm App example. Sadly I am having to downgrade this example to the currently working Flex 3 &#8211; though I intend to upgrade as soon as Mate and Flex 4 learn to play nice.</p>
<p>Below is the Flex 3 application that I will be making using Mate, it should look very similar to the cairngorm application made in the last blog post and will serve as the basic design for each of our applications.</p>
<blockquote><p>I am going to try to refrain from making Cairngorm references but will say that both workflows feel very similar.<br />
event > event collector > executing code > return/fault handlers > data storage
</p></blockquote>
<div id="attachment_518" class="wp-caption alignnone" style="width: 310px"><a href="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/Picture-5.png"><img src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/Picture-5-300x212.png" alt="Mate Application" title="Mate Application" width="300" height="212" class="size-medium wp-image-518" /></a><p class="wp-caption-text">Mate Application</p></div><br />
<span id="more-444"></span><br />
Many people have fallen in love with Mate because the Mate framework makes programming &#8220;like magic&#8221;. Depending on the kind of programmer you are this is a good thing or a bad thing.</p>
<p><strong>Bubbling Events</strong><br />
What makes the Mate framework &#8220;magic&#8221; is the fact that Mate relies on Dependency Injection and Flex Event Bubbling. What does this mean for you? This means that anywhere in your Flex application, fire off the event and the event will be picked up by your designated &#8220;EventMap&#8221; as it bubbles upwards from your subcomponent and then the result will automatically be injected into your view.</p>
<blockquote><p>What is really nice about the Mate framework (and what every Mate developer will say first as a Mate strength) is that the Mate framework&#8217;s events are actually just Flash Events. Nothing special, nothing framework added, just a regular Flash Event.</p></blockquote>
<p>The designated &#8220;EventMap&#8221; will then handle the event as it has been instructed, run a function, a service call, or whatever your application needs. In the case of our application we send off service calls, this is handled by Mate as such:</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span>-- autocomplete --<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mate:EventHandlers <span style="color: #0066CC;">type</span>=<span style="color: #ff0000;">&quot;{AutocompleteEvent.AUTOCOMPLETE}&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>extensions:AutocompleteServiceLoader<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mate:Properties term=<span style="color: #ff0000;">&quot;{currentEvent.term}&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>extensions:resultHandlers<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mate:MethodInvoker <span style="color: #0066CC;">arguments</span>=<span style="color: #ff0000;">&quot;{currentEvent}&quot;</span> generator=<span style="color: #ff0000;">&quot;{TitlesManager}&quot;</span> method=<span style="color: #ff0000;">&quot;autocompleteResult&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>extensions:resultHandlers<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>extensions:faultHandlers<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mate:MethodInvoker <span style="color: #0066CC;">arguments</span>=<span style="color: #ff0000;">&quot;{currentEvent}&quot;</span> generator=<span style="color: #ff0000;">&quot;{TitlesManager}&quot;</span> method=<span style="color: #ff0000;">&quot;autocompleteFault&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>extensions:faultHandlers<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>extensions:AutocompleteServiceLoader<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mate:EventHandlers<span style="color: #66cc66;">&gt;</span></div></div>
<p>This code will accept the AutocompleteEvent event and call for the AutocompleteService service loader.</p>
<blockquote><p>Big Note! If you aren&#8217;t using a straight httpservice or remoteobject Mate will require some Mate specific programming. The next code segment will show you the file necessary to transform your custom event to a Mate acceptable event.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">extensions</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">asfusion</span>.<span style="color: #006600;">mate</span>.<span style="color: #006600;">actionLists</span>.<span style="color: #006600;">IScope</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">asfusion</span>.<span style="color: #006600;">mate</span>.<span style="color: #006600;">actions</span>.<span style="color: #006600;">AbstractServiceInvoker</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">asfusion</span>.<span style="color: #006600;">mate</span>.<span style="color: #006600;">actions</span>.<span style="color: #006600;">IAction</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">catalog</span>.<span style="color: #006600;">TitlesService</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">catalog</span>.<span style="color: #006600;">params</span>.<span style="color: #006600;">CatalogParams</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">NetflixFaultEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">NetflixResultEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">unitedmindset</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">AutocompleteEvent</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AutocompleteServiceLoader <span style="color: #0066CC;">extends</span> AbstractServiceInvoker <span style="color: #0066CC;">implements</span> IAction<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> service:TitlesService;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> term:<span style="color: #0066CC;">String</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> AutocompleteServiceLoader<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; service = <span style="color: #000000; font-weight: bold;">new</span> TitlesService<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentInstance = <span style="color: #0066CC;">this</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> run<span style="color: #66cc66;">&#40;</span>scope:IScope<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; innerHandlersDispatcher = service;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>resultHandlers <span style="color: #66cc66;">&amp;&amp;</span> resultHandlers.<span style="color: #006600;">length</span><span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createInnerHandlers<span style="color: #66cc66;">&#40;</span>scope,NetflixResultEvent.<span style="color: #006600;">RESULT</span>,resultHandlers<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>faultHandlers <span style="color: #66cc66;">&amp;&amp;</span> faultHandlers.<span style="color: #006600;">length</span><span style="color: #66cc66;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createInnerHandlers<span style="color: #66cc66;">&#40;</span>scope,NetflixFaultEvent.<span style="color: #006600;">FAULT</span>,faultHandlers<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> params:CatalogParams = <span style="color: #000000; font-weight: bold;">new</span> CatalogParams<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">e</span>:AutocompleteEvent = scope.<span style="color: #006600;">event</span> as AutocompleteEvent;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; params.<span style="color: #006600;">term</span> = <span style="color: #0066CC;">e</span>.<span style="color: #006600;">term</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; service.<span style="color: #006600;">autoCompleteService</span><span style="color: #66cc66;">&#40;</span>params<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
</blockquote>
<p><strong>Can I get a Manager over here?</strong><br />
With our event being fired off (from anywhere in our application), the Event Map has now received the call and taken action &#8211; in this case, gone to get the service. Now we need to do something with the return. This is where we deal with our data, Managers.</p>
<p>Managers work by having a set of functions to receive the set data from a service or other function. The manager with do the work it needs to accomplish and wrap itself up. Basically, managers &#8220;manage&#8221; your application&#8217;s data.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><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;">unitedmindset</span>.<span style="color: #006600;">managers</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">NetflixFaultEvent</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> com.<span style="color: #006600;">netflix</span>.<span style="color: #006600;">webapis</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">NetflixResultEvent</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">EventDispatcher</span>;<br />
<br />
&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; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TitlesManager <span style="color: #0066CC;">extends</span> EventDispatcher<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">list</span>:<span style="color: #0066CC;">Array</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> autocompleteResult<span style="color: #66cc66;">&#40;</span>event:NetflixResultEvent<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;">list</span> = event.<span style="color: #006600;">result</span> as <span style="color: #0066CC;">Array</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> autocompleteFault<span style="color: #66cc66;">&#40;</span>event:NetflixFaultEvent<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; Alert.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">fault</span>.<span style="color: #006600;">faultDetail</span>,event.<span style="color: #006600;">fault</span>.<span style="color: #006600;">faultString</span><span style="color: #66cc66;">&#41;</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></div>
<p><strong>Injection what?</strong><br />
Dependency injection in it&#8217;s most simple form should remind you of data binding. You set a variable that is plugged into a listener, when that variable is set, it triggers and sets another variable somewhere else in your application. Where are these variables? In Mate, within your managers usually. Where can you set a variable, anywhere else in your application. This is a very helpful construct that simplifies how data moves around your application. An injector example is provided below.</p>
<div class="codecolorer-container actionscript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mate:Injectors <span style="color: #0066CC;">target</span>=<span style="color: #ff0000;">&quot;{NetflixMate}&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mate:PropertyInjector source=<span style="color: #ff0000;">&quot;{TitlesManager}&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; targetKey=<span style="color: #ff0000;">&quot;listDataProvider&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sourceKey=<span style="color: #ff0000;">&quot;list&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mate:Injectors<span style="color: #66cc66;">&gt;</span></div></div>
<p>With all of our code put together in the Mate framework you can now see that we have a Mate application that acts exactly the same as our Cairngorm application. The file downloads and source are provided below.<br />
<div id="attachment_518" class="wp-caption alignnone" style="width: 310px"><a href="http://unitedmindset.com/jonbcampos/wp-content/flex_content/netflix_examples/mate/NetflixMate.html"><img src="http://unitedmindset.com/jonbcampos/wp-content/uploads/2009/06/Picture-5-300x212.png" alt="Mate Application" title="Mate Application" width="300" height="212" class="size-medium wp-image-518" /></a><p class="wp-caption-text">Mate Application</p></div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.unitedmindset.com%2Fjonbcampos%2F2009%2F07%2F01%2Fnetflix-api-with-mate%2F&amp;title=Netflix%20API%20with%20Mate" id="wpa2a_20"><img src="http://www.unitedmindset.com/jonbcampos/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.unitedmindset.com/jonbcampos/2009/07/01/netflix-api-with-mate/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

