<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>Joel Hooks</title>
	<atom:link href="http://joelhooks.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://joelhooks.com</link>
	<description>test until fear turns to boredom.</description>
	<lastBuildDate>Sun, 14 Feb 2010 22:34:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
		<item>
		<title>Robotlegs, AS3-Signals and the SignalCommandMap Example</title>
		<link>http://joelhooks.com/2010/02/14/robotlegs-as3-signals-and-the-signalcommandmap-example/</link>
		<comments>http://joelhooks.com/2010/02/14/robotlegs-as3-signals-and-the-signalcommandmap-example/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 21:39:53 +0000</pubDate>
		<dc:creator>Joel Hooks</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[object oriented concepts]]></category>
		<category><![CDATA[robotlegs]]></category>
		<category><![CDATA[software architecture]]></category>

		<guid isPermaLink="false">http://joelhooks.com/?p=432</guid>
		<description><![CDATA[Robotlegs and AS3-Signals play really well together. Both apply solid object-oriented principles to accomplish their respective goals. Signals is extremely well suited for automated Dependency Injection. By combining Signals and Robotlegs you are able to eliminate the use of Flash Events in the framework layer of your application. Eliminating Events means eliminating the ambiguity that [...]


Related posts:<ol><li><a href='http://joelhooks.com/2010/01/16/robotlegs-image-gallery-example-using-as3-signals-and-the-presentation-model/' rel='bookmark' title='Permanent Link: Robotlegs Image Gallery Example using AS3-Signals and the Presentation Model'>Robotlegs Image Gallery Example using AS3-Signals and the Presentation Model</a></li><li><a href='http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/' rel='bookmark' title='Permanent Link: Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC'>Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC</a></li><li><a href='http://joelhooks.com/2009/08/14/robotlegs-iocdi-flex-framework-examples-updated/' rel='bookmark' title='Permanent Link: Robotlegs IoC/DI Flex Framework Examples Updated'>Robotlegs IoC/DI Flex Framework Examples Updated</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://robotlegs.org">Robotlegs</a> and <a href="http://github.com/robertpenner/as3-signals">AS3-Signals</a> play really well together. Both apply solid object-oriented principles to accomplish their respective goals. Signals is extremely well suited for automated Dependency Injection. By combining Signals and Robotlegs you are able to eliminate the use of Flash Events in the framework layer of your application. Eliminating Events means eliminating the ambiguity that can accompany Events and their String registry based approach to the <a href="http://en.wikipedia.org/wiki/Observer_pattern">Observer pattern</a>. Signals provides a strongly-typed object-oriented approach to this same pattern.</p>
<p>With the standard <a href="http://wiki.github.com/robotlegs/robotlegs-framework/best-practices">Robotlegs MVCS implementation</a> you leverage the events provided by Actionscript 3 to communicate amongst the various actors of an application. From models and services dispatching notifications of their actions to triggering commands, events are a core piece of the implementation. To facilitate the use of Signals within MVCS it was necessary to create an extension to allow for Signals to be registered as Command triggers. This need spawned the <a href="http://github.com/joelhooks/signals-extensions-CommandSignal">SignalCommandMap utility</a>.</p>
<p>The SignalCommandMap extends the normal MVCS context and creates a SignalContext. The SignalContext instantiates and provides access to the SignalCommandMap alongside the other maps that are standard to Robotlegs. The SignalCommandMap allows you to map Signal classes and instances to commands that will be executed when the Signal dispatch() method is called. The value objects that are passed in the dispatch are then injected into the command alongside any other mapped injections you have created.</p>
<p>Let&#8217;s take a look at a simple example that makes use of the SignalCommandMap and discuss some of the underlying code to see how it works:</p>
<div align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_index_2073032425"
			class="flashmovie"
			width="320"
			height="550">
	<param name="movie" value="http://joelhooks.com/examples/robotlegsSignalsCafe/index.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://joelhooks.com/examples/robotlegsSignalsCafe/index.swf"
			name="fm_index_2073032425"
			width="320"
			height="550">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object></div>
<p><a href="http://github.com/joelhooks/robotlegs-examples-RobotlegsSignalsCafe">Source available on Github</a> (<a href="http://github.com/joelhooks/robotlegs-examples-RobotlegsSignalsCafe/zipball/v0.2.4212342">zip</a>)<br />
<span id="more-432"></span><br />
The example is a menu that allows you to add food which is displayed in a list. The total cost of your selected items is displayed and you can remove items from your order. First let&#8217;s get started by taking a look at the context of the Application, which extends SignalContext:</p>
<h6>SignalCafeContext.as Bootstraps the Application</h6>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p432code5'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p4325"><td class="code" id="p432code5"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SignalCafeContext <span style="color: #0066CC;">extends</span> SignalContext
<span style="color: #66cc66;">&#123;</span>
    override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> startup<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
    <span style="color: #66cc66;">&#123;</span>
      injector.<span style="color: #006600;">mapSingleton</span><span style="color: #66cc66;">&#40;</span>FoodOrderModel<span style="color: #66cc66;">&#41;</span>;
      injector.<span style="color: #006600;">mapSingleton</span><span style="color: #66cc66;">&#40;</span>FoodOrderUpdated<span style="color: #66cc66;">&#41;</span>;
      injector.<span style="color: #006600;">mapSingleton</span><span style="color: #66cc66;">&#40;</span>FoodItemAddedToOrder<span style="color: #66cc66;">&#41;</span>;
&nbsp;
      signalCommandMap.<span style="color: #006600;">mapSignalClass</span><span style="color: #66cc66;">&#40;</span>AddFoodItemToOrder, AddFoodItemToOrderCommand<span style="color: #66cc66;">&#41;</span>;
      signalCommandMap.<span style="color: #006600;">mapSignalClass</span><span style="color: #66cc66;">&#40;</span>FoodItemSelected, FoodItemSelectedCommand<span style="color: #66cc66;">&#41;</span>;
      signalCommandMap.<span style="color: #006600;">mapSignalClass</span><span style="color: #66cc66;">&#40;</span>RemoveAllOfSelectedItem, RemoveAllSelectedItemCommand<span style="color: #66cc66;">&#41;</span>;
      signalCommandMap.<span style="color: #006600;">mapSignalClass</span><span style="color: #66cc66;">&#40;</span>NoFoodItemSelected, NoFoodItemSelectedCommand<span style="color: #66cc66;">&#41;</span>;
&nbsp;
      mediatorMap.<span style="color: #006600;">mapView</span><span style="color: #66cc66;">&#40;</span>FoodSelectionView, FoodSelectionViewMediator<span style="color: #66cc66;">&#41;</span>;
      mediatorMap.<span style="color: #006600;">mapView</span><span style="color: #66cc66;">&#40;</span>CurrentOrderView, CurrentOrderViewMediator<span style="color: #66cc66;">&#41;</span>;
      mediatorMap.<span style="color: #006600;">mapView</span><span style="color: #66cc66;">&#40;</span>FoodOrderSummaryView, FoodOrderSummaryViewMediator<span style="color: #66cc66;">&#41;</span>;
      mediatorMap.<span style="color: #006600;">mapView</span><span style="color: #66cc66;">&#40;</span>FoodItemRemovalView, FoodItemRemovalViewMediator<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>A SignalContext is structured exactly the same as a standard Robotlegs MVCS Context class. You override the startup() method and bootstrap your application. The major difference here is that you are mapping signals to commands instead of mapping events to commands. With the SignalCommandMap you are not restricted to just using Signals for triggering commands. You could mix events and Signals liberally as your needs or requirements dictated. As a warning, this could quickly became confusing and choosing one or the other might be a saner choice.</p>
<p>SignalCafeContext is mapping 4 Signals to 4 commands. The Signals are typed extensions of the base Signal class. This is necessary to provide Robotlegs (and more specifically in this case SwiftSuspenders) object types to differentiate for the purposes of injection. You could use named injections, but this would rapidly riddle your application with strings that would need to be laboriously checked for accuracy. Avoiding strings in favor of compiler-checked object types is always a good choice.</p>
<p>The strongly typed Signals are relatively simple. They contain a constructor and no additional methods or properties are added to the Signal. You can of course add properties and methods to the extended Signals,, but it wasn&#8217;t necessary for this example. The SignalCommandMap will accept any class that implements the ISignal interface. Let&#8217;s take a look at one of the commands triggered by a Signal mapped in the SignalCafeContext:</p>
<h6>AddFoodItemToOrder.as triggers the AddFoodItemToOrderCommand</h6>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p432code6'); return false;">View Code</a> ACTIONSCIRPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p4326"><td class="code" id="p432code6"><pre class="actionscirpt" style="font-family:monospace;">public class AddFoodItemToOrder extends Signal
{
	public function AddFoodItemToOrder()
	{
		super(FoodType);
	}
}</pre></td></tr></table></div>

<p>That is the whole of the extended Signal. As mentioned, it is not very complex at all. You will notice that super(FoodType) is being called. Signals take constructor arguments consisting of classes or interfaces that will be used as the value objects transmitted via the dispatch() method. In this case we are using FoodType as this value to ensure that our Signal will carry the payload that the mapped command is expecting.</p>
<p>Command signals are named a bit differently than standard reaction Signals. A Signal that is triggering a command is &#8220;requesting action&#8221; or specifying an action that needs to occur. Standard signals are typically past tense, or informative, describing an action that has occurred. By using this standard it is much easier to differentiate quickly what each Signal&#8217;s purpose is. This can help with overall clarity within your application.</p>
<p>The AddFoodItemToOrder signal is dispatched by the FoodSelectionViewMediator which is mediating the DropDownList of FoodTypes and the &#8220;Add Some Food&#8221; button:</p>
<h6>FoodSelectionViewMediator.as mediates a view and dispatches a Signal when the user has clicked the &#8220;Add Some Food&#8221; button</h6>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p432code7'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p4327"><td class="code" id="p432code7"><pre class="actionscript" style="font-family:monospace;">	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FoodSelectionViewMediator <span style="color: #0066CC;">extends</span> Mediator
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> view:FoodSelectionView;
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> addItem:AddFoodItemToOrder;
&nbsp;
		override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> onRegister<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			view.<span style="color: #006600;">itemTypeAdded</span>.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>handleItemTypeAdded<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> handleItemTypeAdded<span style="color: #66cc66;">&#40;</span>itemType:FoodType<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			addItem.<span style="color: #006600;">dispatch</span><span style="color: #66cc66;">&#40;</span>itemType<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>When the AddFoodItemToOrder Signal&#8217;s dispatch(aFoodTypeInstance) is called the AddFoodItemToOrderCommand is triggered:</p>
<h6>AddFoodItemToOrderCommand.as is executed in response to AddFoodItemToOrder Signal dispatch</h6>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p432code8'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p4328"><td class="code" id="p432code8"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AddFoodItemToOrderCommand <span style="color: #0066CC;">extends</span> SignalCommand
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> itemType:FoodType;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> model:FoodOrderModel;
&nbsp;
	override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> execute<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		model.<span style="color: #006600;">addItemToOrder</span><span style="color: #66cc66;">&#40;</span>itemType<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>AddFoodItemToOrderCommand has two public properties that are marked for injection. The itemType property is a FoodType object. As you will recall, FoodType is the parameter that was passed to the AddFoodItemToOrder Signal super constructor. The AddFoodItemToOrder Signal dispatch() included an instance of a FoodType object which will be injected into the AddFoodItemToOrderCommand alongside any other injections that have been mapped and specified. In this case we are also injecting the FoodOrderModel instance that was mapped as a singleton in the SignalCafeContext.</p>
<div class="note-block">It is important to note that the parameters passed via the Signals dispatch() method will be instantly mapped and unmapped when the command is executed. If you&#8217;ve previously mapped a class that is being delivered via a Signal command mapping, that mapping will be overwritten and removed. To avoid this, favor using typed value objects as Signal parameters.</div>
<p>The AddFoodItemToOrderCommand has a simple job. It accesses the FoodOrderModel instance and calls its addItemToOrder method adding the FoodType parameter that was dispatched with the Signal to trigger the command. </p>
<p>That covers the basics of using the SignalCommandMap within a Robotlegs application. There are options that this example doesn&#8217;t cover. I would recommend looking through the SignalCommandMap unit test suite for a thorough review of its capabilities. There are several more commands and Signals in the example for you to look over as well. Additionally the example uses Signals within views and the model to dispatch notifications. Outside of binding and UI events, no events are being passed within the application.</p>
<p>Hopefully this will give you the basic understanding of using the SignalCommandMap in a Robotlegs application. Let me know if you have any criticisms, comments, suggestions, or ideas regarding the utility&#8217;s implementation at <a href="http://knowledge.robotlegs.org">http://knowledge.robotlegs.org</a></p>


<p>Related posts:<ol><li><a href='http://joelhooks.com/2010/01/16/robotlegs-image-gallery-example-using-as3-signals-and-the-presentation-model/' rel='bookmark' title='Permanent Link: Robotlegs Image Gallery Example using AS3-Signals and the Presentation Model'>Robotlegs Image Gallery Example using AS3-Signals and the Presentation Model</a></li><li><a href='http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/' rel='bookmark' title='Permanent Link: Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC'>Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC</a></li><li><a href='http://joelhooks.com/2009/08/14/robotlegs-iocdi-flex-framework-examples-updated/' rel='bookmark' title='Permanent Link: Robotlegs IoC/DI Flex Framework Examples Updated'>Robotlegs IoC/DI Flex Framework Examples Updated</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://joelhooks.com/2010/02/14/robotlegs-as3-signals-and-the-signalcommandmap-example/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Robotlegs on RIA Radio with Shaun Smith and Myself</title>
		<link>http://joelhooks.com/2010/01/28/robotlegs-on-ria-radio-with-shaun-smith-and-myself/</link>
		<comments>http://joelhooks.com/2010/01/28/robotlegs-on-ria-radio-with-shaun-smith-and-myself/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 20:43:19 +0000</pubDate>
		<dc:creator>Joel Hooks</dc:creator>
				<category><![CDATA[robotlegs]]></category>

		<guid isPermaLink="false">http://joelhooks.com/?p=420</guid>
		<description><![CDATA[Shaun on I were on episode 6 of RIA Radio to talk about Robotlegs. Check it out!



No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<div><a href="http://www.insideria.com/2010/01/episode-6-shaun-smith-and-joel.html"><img alt="" src="http://cdn.oreilly.com/digitalmedia/insideria/2009/10/ria-radio-logo-sm.png" title="RIARadio" class="alignleft" width="148" height="93" /></a>Shaun on I were on episode 6 of RIA Radio to talk about Robotlegs. <a href="http://www.insideria.com/2010/01/episode-6-shaun-smith-and-joel.html">Check it out</a>!</div>
<p><br/><br/><br/><br/><br/><br/><br/></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://joelhooks.com/2010/01/28/robotlegs-on-ria-radio-with-shaun-smith-and-myself/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Robotlegs Image Gallery Example using AS3-Signals and the Presentation Model</title>
		<link>http://joelhooks.com/2010/01/16/robotlegs-image-gallery-example-using-as3-signals-and-the-presentation-model/</link>
		<comments>http://joelhooks.com/2010/01/16/robotlegs-image-gallery-example-using-as3-signals-and-the-presentation-model/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 22:56:36 +0000</pubDate>
		<dc:creator>Joel Hooks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[object oriented concepts]]></category>
		<category><![CDATA[robotlegs]]></category>

		<guid isPermaLink="false">http://joelhooks.com/?p=386</guid>
		<description><![CDATA[Jason Crist posted a thought provoking request for his upcoming presentation comparing Robotlegs and Swiz. He&#8217;s got a clever knack for stirring the framework ant pile and getting developers eyes off their IDEs long enough to discuss their passions. In this case the developers include Ben Clinkinbeard, Shaun Smith, Jesse Warden and myself.
These conversations are [...]


Related posts:<ol><li><a href='http://joelhooks.com/2010/02/14/robotlegs-as3-signals-and-the-signalcommandmap-example/' rel='bookmark' title='Permanent Link: Robotlegs, AS3-Signals and the SignalCommandMap Example'>Robotlegs, AS3-Signals and the SignalCommandMap Example</a></li><li><a href='http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/' rel='bookmark' title='Permanent Link: Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC'>Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC</a></li><li><a href='http://joelhooks.com/2008/04/21/continuous-scrolling-image-thumbnail-component-for-flex/' rel='bookmark' title='Permanent Link: Continuous scrolling image thumbnail component for Flex.'>Continuous scrolling image thumbnail component for Flex.</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Jason Crist <a href="http://pbking.com/blog/?p=209">posted a thought provoking request</a> for his upcoming presentation comparing <a href="http://www.robotlegs.org">Robotlegs</a> and <a href="http://swizframework.org/">Swiz</a>. He&#8217;s got a clever knack for stirring the framework ant pile and getting developers eyes off their IDEs long enough to discuss their passions. In this case the developers include <a href="http://www.benclinkinbeard.com/">Ben Clinkinbeard</a>, <a href="http://shaun.boyblack.co.za/blog/">Shaun Smith</a>, <a href="http://jessewarden.com/">Jesse Warden</a> and myself.</p>
<p>These conversations are always good natured. While we work on (or use) &#8220;competing&#8221; frameworks there is always a sense of mutual respect. We like our tools but have obvious inclinations towards the projects that we&#8217;ve invested our hearts and souls into.</p>
<p>Ben Clinkinbeard has pointed out (several times!) that Robotlegs is all about extending the <a href="http://github.com/robotlegs/robotlegs-framework/tree/master/src/org/robotlegs/mvcs/">MVCS classes</a>. My stock answer is that there is a clear separation between the framework and the concrete MVCS implementation. To paraphrase Ben, &#8220;Well show it to me then!&#8221;</p>
<p>All of the <a href="http://www.robotlegs.org/examples/">&#8220;official&#8221; Robotlegs examples</a> are making use of the MVCS implementation. Why? Because it is solid, recognizable, and fairly easy to get one&#8217;s head around. It provides a common ground for developers and a set architectural structure which is a huge advantage in any team environment. It is important to make the distinction  between the framework and the MVCS implementation. What does that even mean? At the core, Robotlegs is a modular set of tools to provide a convenient mechanism for wiring applications. Robotlegs is not doing class reflection. Robotlegs is not an automated dependency injection solution. Robotlegs is  an adapter to a dependency injection solution,by default the lightweight <a href="http://github.com/tschneidereit/SwiftSuspenders">SwiftSuspenders library</a>. Through a set of tools, namely the MediatorMap, CommandMap, ViewMap, and the injection adapter Robotlegs provides a robust starting place to begin coding your application.</p>
<p>The MVCS implementation is a set of base classes loosely modeled on <a href="http://puremvc.org/">PureMVC</a>. At the heart of the implementation is the Context. The Context creates instances of the various mapping classes, the injection adapter, and gives the developer a centralized IEventDispatcher that can be used for messaging between application tiers.. The other three classes, Actor, Mediator, and Command, reduce boiler plate and provide convenient access to injected dependencies typically used in the the MVCS tiers.</p>
<p>What if you hate PureMVC, don&#8217;t want to extend any framework classes, or generally just want to work in a different way outside of a prescribed MVCS architecture?</p>
<p>No problem.</p>
<p>Here&#8217;s the deal. Robotlegs, the framework, is a <a href="http://github.com/robotlegs/robotlegs-framework/tree/master/src/org/robotlegs/core/">set of interfaces</a>. You can effectively do whatever you want with these interfaces. You can make use of the base concrete implementations of the core interfaces, use a class from the MVCS implementation, implement your own concrete classes based on the framework core, bring in other libraries or any combination you can think of. In terms of a framework, Robotlegs can be whatever you want/need it to be.</p>
<h2>Man Joel, that was a long intro. Where&#8217;s the freaking code??!?</h2>
<p><span id="more-386"></span><br />
So, to that end, I sat down to rework <a href="http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-–-inspired-by-puremvc/">my first (and still favorite) Robotlegs example application</a> and demonstrate this concept a bit.</p>
<p>I&#8217;ve stripped the example down slightly, using just the XMLImageService and not connecting to Flickr (in an effort to keep it simple).</p>
<p><a href="http://github.com/joelhooks/robotlegs-examples-ImageGalleryPM">Get the source on GitHub</a><br />
<a href="http://github.com/joelhooks/robotlegs-examples-ImageGalleryPM/zipball/v1.0.0"><strong>Download the full source as a Zip</strong></a></p>
<p><strong>This example requires:</strong><br />
<a href="http://www.robotlegs.org/">Robotlegs</a><br />
<a href="http://github.com/robertpenner/as3-signals">AS3-Signals</a><br />
<a href="http://github.com/joelhooks/signals-extensions-CommandSignal">SignalsCommandMap library</a><br />
<a href="http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4">Flex 4 SDK (a fairly recent version)</a></p>
<div class="note-block" align="center"><strong>You neeed <a href="http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4">SDK version 4.0.0.12635 or later</a> to compile this&#8230;</strong></div>
<div align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_index_1725414145"
			class="flashmovie"
			width="400"
			height="500">
	<param name="movie" value="http://joelhooks.com/examples/robotlegsGalleryPM/index.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://joelhooks.com/examples/robotlegsGalleryPM/index.swf"
			name="fm_index_1725414145"
			width="400"
			height="500">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object></div>
<p><br/><br />
The example should be familiar if you&#8217;ve looked at the Image Gallery previously. It loads images from a service and displays them. This version is much different on the code level however. Instead of mediators and data models, the gallery is using presentation models and AS3-Signals. It still uses the Context from the MVCS implementation. it&#8217;s so f&#8217;n handy and I don&#8217;t want to manually instantiate the maps. </p>
<h3>ImageGalleryContext</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p386code17'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p38617"><td class="code" id="p386code17"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ImageGalleryContext <span style="color: #0066CC;">extends</span> Context
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">private</span> const VIEW_PACKAGE:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;org.robotlegs.examples.imagegallery.view.components&quot;</span>;
	<span style="color: #0066CC;">private</span> const LOAD_GALLERY:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;loadGallery&quot;</span>;
&nbsp;
	override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> startup<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">//map the views</span>
		viewMap.<span style="color: #006600;">mapPackage</span><span style="color: #66cc66;">&#40;</span>VIEW_PACKAGE<span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//map the presentation models</span>
		injector.<span style="color: #006600;">mapSingletonOf</span><span style="color: #66cc66;">&#40;</span> IGalleryViewPresentationModel, GalleryViewPresentationModel <span style="color: #66cc66;">&#41;</span>;
		injector.<span style="color: #006600;">mapSingletonOf</span><span style="color: #66cc66;">&#40;</span> IGalleryThumbnailsPresentationModel, GalleryThumbnailsPresentationModel <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//map the services and their factories</span>
		injector.<span style="color: #006600;">mapSingletonOf</span><span style="color: #66cc66;">&#40;</span> IGalleryImageService, XMLImageService <span style="color: #66cc66;">&#41;</span>;
		injector.<span style="color: #006600;">mapSingletonOf</span><span style="color: #66cc66;">&#40;</span> IGalleryFactory, XMLGalleryFactory <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//map the signals</span>
		injector.<span style="color: #006600;">mapSingleton</span><span style="color: #66cc66;">&#40;</span>GalleryUpdatedSignal<span style="color: #66cc66;">&#41;</span>;
		injector.<span style="color: #006600;">mapSingleton</span><span style="color: #66cc66;">&#40;</span>GalleryImageSelectedSignal<span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//map the command</span>
		commandMap.<span style="color: #006600;">mapEvent</span><span style="color: #66cc66;">&#40;</span> LOAD_GALLERY, LoadGalleryCommand <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">//go!!</span>
		eventDispatcher.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span>LOAD_GALLERY<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>As you can see here the context is performing the duty of mapping the injections the application will use. </p>
<h3>Automated Dependency Injected View</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p386code18'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p38618"><td class="code" id="p386code18"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>s:Group xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> 
		 xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> 
		 xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</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><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>fx:Script<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
			<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">examples</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">view</span>.<span style="color: #006600;">models</span>.<span style="color: #006600;">IGalleryThumbnailsPresentationModel</span>;
&nbsp;
			<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _model:IGalleryThumbnailsPresentationModel;
&nbsp;
			<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> model<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:IGalleryThumbnailsPresentationModel
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #b1b100;">return</span> _model;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
			<span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
			<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> model<span style="color: #66cc66;">&#40;</span>value:IGalleryThumbnailsPresentationModel<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
			<span style="color: #66cc66;">&#123;</span>
				_model = value;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>fx:Script<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>s:Rect <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>
		<span style="color: #66cc66;">&lt;</span>s:fill<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>s:SolidColor <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;#111111&quot;</span><span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>s:fill<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>s:Rect<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>s:Group <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>
		<span style="color: #66cc66;">&lt;</span>s:layout<span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>s:VerticalLayout gap=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #66cc66;">/&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>s:layout<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>s:DataGroup id=<span style="color: #ff0000;">&quot;dgThumbnails&quot;</span>
					 clipAndEnableScrolling=<span style="color: #ff0000;">&quot;true&quot;</span>
					 dataProvider=<span style="color: #ff0000;">&quot;{model.dataProvider}&quot;</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;85&quot;</span> 
					 itemRenderer=<span style="color: #ff0000;">&quot;org.robotlegs.examples.imagegallery.view.components.renderers.GalleryImageThumbnailItemRenderer&quot;</span><span style="color: #66cc66;">&gt;</span>
			<span style="color: #66cc66;">&lt;</span>s:layout<span style="color: #66cc66;">&gt;</span>
				<span style="color: #66cc66;">&lt;</span>s:HorizontalLayout gap=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #66cc66;">/&gt;</span>
			<span style="color: #66cc66;">&lt;/</span>s:layout<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;/</span>s:DataGroup<span style="color: #66cc66;">&gt;</span>
		<span style="color: #66cc66;">&lt;</span>s:HScrollBar id=<span style="color: #ff0000;">&quot;thumbScrollBar&quot;</span>
					  viewport=<span style="color: #ff0000;">&quot;{dgThumbnails}&quot;</span>
					  <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span>
					  smoothScrolling=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">/&gt;</span>
	<span style="color: #66cc66;">&lt;/</span>s:Group<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;/</span>s:Group<span style="color: #66cc66;">&gt;</span></pre></td></tr></table></div>

<p>The viewMap is set to map the entire components folder. This is a convenient way to provide automated dependency injection to a large number of views. It also maps views in any sub-package of the mapped package. </p>
<h3>GalleryViewThumbnailsPresentationModel</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p386code19'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p38619"><td class="code" id="p386code19"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> GalleryThumbnailsPresentationModel <span style="color: #0066CC;">implements</span> IGalleryThumbnailsPresentationModel
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> updated:GalleryUpdatedSignal;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> imageSelected:GalleryImageSelectedSignal;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>PostConstruct<span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> mapSignalListeners<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		updated.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>galleryUpdated<span style="color: #66cc66;">&#41;</span>;
		imageSelected.<span style="color: #0066CC;">add</span><span style="color: #66cc66;">&#40;</span>updateImageSelectionState<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _dataprovider:ArrayCollection;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> dataProvider<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:ArrayCollection
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">return</span> _dataprovider;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> dataProvider<span style="color: #66cc66;">&#40;</span>v:ArrayCollection<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		_dataprovider = v;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> galleryUpdated<span style="color: #66cc66;">&#40;</span>gallery:Gallery<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		dataProvider = gallery.<span style="color: #006600;">photos</span>;
		<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>gallery.<span style="color: #006600;">photos</span><span style="color: #66cc66;">&#91;</span>0<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			imageSelected.<span style="color: #006600;">dispatch</span><span style="color: #66cc66;">&#40;</span>gallery.<span style="color: #006600;">photos</span><span style="color: #66cc66;">&#91;</span>0<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> updateImageSelectionState<span style="color: #66cc66;">&#40;</span>image:GalleryImage<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> galleryImage:GalleryImage <span style="color: #b1b100;">in</span> dataProvider<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			galleryImage.<span style="color: #006600;">selected</span> = galleryImage == image;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<h3>IGalleryViewThumbnailsPresentationModel</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p386code20'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p38620"><td class="code" id="p386code20"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
 * This interface is simple because the application is simple. Obviously in
 * a large application you'd get more complex interfaces. 
 */</span>	
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">interface</span> IGalleryThumbnailsPresentationModel
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> dataProvider<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:ArrayCollection;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>The presentation models are provided as singletons. The application will only display one of each view that requires the model. They are also mapped as interfaces with the interfaces being injected into the views. With the presentation model, the view does not update the model directly. By using interfaces we can supply read-only contracts between the presentation models and the views they control:</p>
<h3>XMLImageService</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p386code21'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p38621"><td class="code" id="p386code21"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> XMLImageService <span style="color: #0066CC;">implements</span> IGalleryImageService
<span style="color: #66cc66;">&#123;</span>
	protected <span style="color: #0066CC;">static</span> const BASE_URL:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;assets/gallery/&quot;</span>;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> galleryFactory:IGalleryFactory;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> galleryUpdated:GalleryUpdatedSignal;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> XMLImageService<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> loadGallery<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> service:HTTPService = <span style="color: #000000; font-weight: bold;">new</span> HTTPService<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000000; font-weight: bold;">var</span> responder:Responder = <span style="color: #000000; font-weight: bold;">new</span> Responder<span style="color: #66cc66;">&#40;</span>handleServiceResult, handleServiceFault<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000000; font-weight: bold;">var</span> token:AsyncToken;
		service.<span style="color: #006600;">resultFormat</span> = <span style="color: #ff0000;">&quot;e4x&quot;</span>;
		service.<span style="color: #0066CC;">url</span> = BASE_URL+<span style="color: #ff0000;">&quot;gallery.xml&quot;</span>;
		token = service.<span style="color: #0066CC;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		token.<span style="color: #006600;">addResponder</span><span style="color: #66cc66;">&#40;</span>responder<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	protected <span style="color: #000000; font-weight: bold;">function</span> handleServiceResult<span style="color: #66cc66;">&#40;</span>event:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> gallery:Gallery = galleryFactory.<span style="color: #006600;">createGallery</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">result</span>.<span style="color: #006600;">image</span>, BASE_URL<span style="color: #66cc66;">&#41;</span>;
		galleryUpdated.<span style="color: #006600;">dispatch</span><span style="color: #66cc66;">&#40;</span> gallery <span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	protected <span style="color: #000000; font-weight: bold;">function</span> handleServiceFault<span style="color: #66cc66;">&#40;</span>event:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<h3>IGalleryImageService</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p386code22'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p38622"><td class="code" id="p386code22"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">interface</span> IGalleryImageService
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">function</span> loadGallery<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>The service and its factory class are also mapped as singleton interfaces. This makes it really easy to swap out services (to add a Flickr service for example). </p>
<h3>GalleryUpdatedSignal</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p386code23'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p38623"><td class="code" id="p386code23"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> GalleryUpdatedSignal <span style="color: #0066CC;">extends</span> Signal
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> GalleryUpdatedSignal<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span>Gallery<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>The signals are simple classes that merely extend the Signal class and declare their payload type in the super() of the constructor. Signals are a really marvelous concept and provide a lot of very nice functionality. They make a great companion to Robotlegs and I think you will see some really cool stuff being done with Signals and Robotlegs in the very near future.</p>
<h3>LoadGalleryCommand</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p386code24'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p38624"><td class="code" id="p386code24"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> LoadGalleryCommand
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> service:IGalleryImageService;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> execute<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		service.<span style="color: #006600;">loadGallery</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>The application has a single command, LoadGalleryCommand, that is used to actually load the initial images from service and is only called once. In fact, the event that is fired to launch this command in the context startup method is the only event that this application uses (outside of the Flex events on the UI items). That is awesome!</p>
<p>Something you will notice right away looking at the source is that the ImageGalleryContext is the only class that extends a Robotlegs class. You could do without that too, frankly, and create your own context that created the maps and injector instances. I&#8217;m not a masochist however, and I will use the provided context for this example. There is a huge amount of potential there for implementing your own custom contexts. I think an interesting implementation might pitch Flash Events altogether and use only Signals for communication between application actors. This example is essentially doing that, but I&#8217;d like to get rid of that single event in startup too!</p>
<p><a href="http://github.com/joelhooks/robotlegs-examples-ImageGalleryPM/zipball/v1.0.0"><strong>Download the full source as a Zip</strong></a></p>
<p>Let me know if you make something cool with Robotlegs and post details about it, I&#8217;ve got a stack of these to give away:</p>
<div align="center"><a href="http://joelhooks.com/wp-content/uploads/2010/01/photo.jpg" rel="shadowbox[post-386];player=img;"><img src="http://joelhooks.com/wp-content/uploads/2010/01/photo-225x300.jpg" alt="photo" title="photo" width="225" height="300" /></a></div>


<p>Related posts:<ol><li><a href='http://joelhooks.com/2010/02/14/robotlegs-as3-signals-and-the-signalcommandmap-example/' rel='bookmark' title='Permanent Link: Robotlegs, AS3-Signals and the SignalCommandMap Example'>Robotlegs, AS3-Signals and the SignalCommandMap Example</a></li><li><a href='http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/' rel='bookmark' title='Permanent Link: Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC'>Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC</a></li><li><a href='http://joelhooks.com/2008/04/21/continuous-scrolling-image-thumbnail-component-for-flex/' rel='bookmark' title='Permanent Link: Continuous scrolling image thumbnail component for Flex.'>Continuous scrolling image thumbnail component for Flex.</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://joelhooks.com/2010/01/16/robotlegs-image-gallery-example-using-as3-signals-and-the-presentation-model/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Continuous Scrolling Thumbnail Component for Flex</title>
		<link>http://joelhooks.com/2009/12/24/continuous-scrolling-thumbnail-component-for-flex/</link>
		<comments>http://joelhooks.com/2009/12/24/continuous-scrolling-thumbnail-component-for-flex/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 04:37:27 +0000</pubDate>
		<dc:creator>Joel Hooks</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://joelhooks.com/?p=378</guid>
		<description><![CDATA[This post continues to be the most popular on this space after a year and a half. I&#8217;ve never been particularly fond of the implmenetation. Tightly coupled to very specific data sets and not really anything like a Flex component. It is setup more like an application (because it was pulled out of an application [...]


Related posts:<ol><li><a href='http://joelhooks.com/2008/04/21/continuous-scrolling-image-thumbnail-component-for-flex/' rel='bookmark' title='Permanent Link: Continuous scrolling image thumbnail component for Flex.'>Continuous scrolling image thumbnail component for Flex.</a></li><li><a href='http://joelhooks.com/2008/05/11/continuous-scrolling-image-thumbnail-and-slideshow-component-for-flex/' rel='bookmark' title='Permanent Link: Continuous scrolling image thumbnail and slideshow component for Flex.'>Continuous scrolling image thumbnail and slideshow component for Flex.</a></li><li><a href='http://joelhooks.com/2008/05/24/updated-continuous-scrolling-image-thumbnail-and-slideshow-component-for-flex/' rel='bookmark' title='Permanent Link: Updated: Continuous scrolling image thumbnail and slideshow component for Flex.'>Updated: Continuous scrolling image thumbnail and slideshow component for Flex.</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://joelhooks.com/2008/05/11/continuous-scrolling-image-thumbnail-and-slideshow-component-for-flex/">This post</a> continues to be the most popular on this space after a year and a half. I&#8217;ve never been particularly fond of the implmenetation. Tightly coupled to very specific data sets and not really anything like a Flex component. It is setup more like an application (because it was pulled out of an application and generalized).</p>
<p>I&#8217;ve finally found the opportunity to rewrite the continuous scrolling thumbnail view portion of the slideshow and I am much happier with the results. Now, instead of resembling an application it is structured like a standard Flex 3 List based component. You supply it with a dataProvider and an itemRenderer (IListItemRenderer) and it acts as you would expect it to. </p>
<p>This approach is much nicer, as the data is cleanly decoupled from the component implementation and it opens up the doors for reuse. </p>
<p><a href="http://github.com/joelhooks/components-thumbScroller">The code is available on Github</a>. If you have any suggestions or would like to add to the component, fork it and let me know!</p>
<div align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_SimpleSlideshow_1704043812"
			class="flashmovie"
			width="450"
			height="600">
	<param name="movie" value="http://joelhooks.com/examples/thumbScroller/SimpleSlideshow.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://joelhooks.com/examples/thumbScroller/SimpleSlideshow.swf"
			name="fm_SimpleSlideshow_1704043812"
			width="450"
			height="600">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object></div>


<p>Related posts:<ol><li><a href='http://joelhooks.com/2008/04/21/continuous-scrolling-image-thumbnail-component-for-flex/' rel='bookmark' title='Permanent Link: Continuous scrolling image thumbnail component for Flex.'>Continuous scrolling image thumbnail component for Flex.</a></li><li><a href='http://joelhooks.com/2008/05/11/continuous-scrolling-image-thumbnail-and-slideshow-component-for-flex/' rel='bookmark' title='Permanent Link: Continuous scrolling image thumbnail and slideshow component for Flex.'>Continuous scrolling image thumbnail and slideshow component for Flex.</a></li><li><a href='http://joelhooks.com/2008/05/24/updated-continuous-scrolling-image-thumbnail-and-slideshow-component-for-flex/' rel='bookmark' title='Permanent Link: Updated: Continuous scrolling image thumbnail and slideshow component for Flex.'>Updated: Continuous scrolling image thumbnail and slideshow component for Flex.</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://joelhooks.com/2009/12/24/continuous-scrolling-thumbnail-component-for-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>TexFlex09 Robotlegs Slides and a Robotlegs T-Shirt Giveaway</title>
		<link>http://joelhooks.com/2009/11/14/texflex09-robotlegs-slides-and-a-robotlegs-t-shirt-giveaway/</link>
		<comments>http://joelhooks.com/2009/11/14/texflex09-robotlegs-slides-and-a-robotlegs-t-shirt-giveaway/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 07:04:28 +0000</pubDate>
		<dc:creator>Joel Hooks</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[robotlegs]]></category>

		<guid isPermaLink="false">http://joelhooks.com/?p=368</guid>
		<description><![CDATA[TexFlex09 was a lot of fun. I had some t-shirts printed for the event, and still have a good sized stack of them left over. I thought it would be fun to give them to people who created interesting examples, tutorials, or screen casts of Robotlegs in action. Just make something cool and post it, [...]


Related posts:<ol><li><a href='http://joelhooks.com/2009/08/14/robotlegs-iocdi-flex-framework-examples-updated/' rel='bookmark' title='Permanent Link: Robotlegs IoC/DI Flex Framework Examples Updated'>Robotlegs IoC/DI Flex Framework Examples Updated</a></li><li><a href='http://joelhooks.com/2010/02/14/robotlegs-as3-signals-and-the-signalcommandmap-example/' rel='bookmark' title='Permanent Link: Robotlegs, AS3-Signals and the SignalCommandMap Example'>Robotlegs, AS3-Signals and the SignalCommandMap Example</a></li><li><a href='http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/' rel='bookmark' title='Permanent Link: Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC'>Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://joelhooks.com/wp-content/uploads/2009/11/robotlegs_-1-150x150.jpg" alt="robotlegs_-1" title="robotlegs_-1" width="75" height="75" class="alignright size-thumbnail wp-image-370" />TexFlex09 was a lot of fun. I had some t-shirts printed for the event, and still have a good sized stack of them left over. I thought it would be fun to give them to people who created interesting examples, tutorials, or screen casts of <a href="http://robotlegs.org">Robotlegs</a> in action. Just make something cool and post it, and I will send you a <a href="http://robotlegs.org">Robotlegs</a> t-shirt (while supplies last!)</p>
<div align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_texflexss_1416582294"
			class="flashmovie"
			width="545"
			height="357">
	<param name="movie" value="/texflexss.swf" />
	<param name="allowscriptaccess" value="always" />
	<param name="allowfullscreen" value="true" />
	<param name="allownetworking" value="all" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/texflexss.swf"
			name="fm_texflexss_1416582294"
			width="545"
			height="357">
		<param name="allowscriptaccess" value="always" />
		<param name="allowfullscreen" value="true" />
		<param name="allownetworking" value="all" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object></div>


<p>Related posts:<ol><li><a href='http://joelhooks.com/2009/08/14/robotlegs-iocdi-flex-framework-examples-updated/' rel='bookmark' title='Permanent Link: Robotlegs IoC/DI Flex Framework Examples Updated'>Robotlegs IoC/DI Flex Framework Examples Updated</a></li><li><a href='http://joelhooks.com/2010/02/14/robotlegs-as3-signals-and-the-signalcommandmap-example/' rel='bookmark' title='Permanent Link: Robotlegs, AS3-Signals and the SignalCommandMap Example'>Robotlegs, AS3-Signals and the SignalCommandMap Example</a></li><li><a href='http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/' rel='bookmark' title='Permanent Link: Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC'>Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://joelhooks.com/2009/11/14/texflex09-robotlegs-slides-and-a-robotlegs-t-shirt-giveaway/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Robotlegs MVCS: Walkthrough of an AIR Twitter Client</title>
		<link>http://joelhooks.com/2009/11/11/a-walkthrough-of-an-air-twitter-client-using-robotlegs-mvcs/</link>
		<comments>http://joelhooks.com/2009/11/11/a-walkthrough-of-an-air-twitter-client-using-robotlegs-mvcs/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 17:46:56 +0000</pubDate>
		<dc:creator>Joel Hooks</dc:creator>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[robotlegs]]></category>
		<category><![CDATA[screencast]]></category>
		<category><![CDATA[MVCS]]></category>

		<guid isPermaLink="false">http://joelhooks.com/?p=349</guid>
		<description><![CDATA[
Here is the &#8220;completed&#8221; project on Github.
This is a roughly 25 minute walkthrough of wiring together a Twitter client using the Robotlegs AS3 Micro-Architecture MVCS implementation. It covers setting up the context, using commands, mediating composite view component, granular view component mediation, and retrieving data from a service.
Apologies in advance for the ambient noise. 4 [...]


Related posts:<ol><li><a href='http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/' rel='bookmark' title='Permanent Link: Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC'>Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC</a></li><li><a href='http://joelhooks.com/2008/03/14/complex-datagrid-filterfunction-in-flexair/' rel='bookmark' title='Permanent Link: Complex DataGrid filterFunction in Flex/Air'>Complex DataGrid filterFunction in Flex/Air</a></li><li><a href='http://joelhooks.com/2008/02/09/vesession-flex-photography-studio-client-ordering-application/' rel='bookmark' title='Permanent Link: VEsession &#8211; Flex photography studio management and client ordering application'>VEsession &#8211; Flex photography studio management and client ordering application</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://robotlegs.joelhooks.com/twit/rl_twitter.mov" rel="shadowbox;height=568;width=960"><img src="http://joelhooks.com/wp-content/uploads/2009/11/rl_twit_ss.png" alt="rl_twit_ss" title="rl_twit_ss" width="490" height="257" class="aligncenter size-full wp-image-354" /></a></p>
<p><a href="http://github.com/joelhooks/robotlegs-examples-Twitter"><strong>Here is the &#8220;completed&#8221; project on Github.</strong></a></p>
<p>This is a roughly 25 minute walkthrough of wiring together a Twitter client using the Robotlegs AS3 Micro-Architecture MVCS implementation. It covers setting up the context, using commands, mediating composite view component, granular view component mediation, and retrieving data from a service.</p>
<p>Apologies in advance for the ambient noise. 4 kids, 2 dogs, and a busy wife does not make the perfect sound booth <img src='http://joelhooks.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I am considering expanding on this example and creating a start to finish video series creating a full Twitter client with Robotlegs. This would cover the actual component building, wiring everything together, working with data models (local storage, etc), and refining the application to use the advanced features available with the Twitter API using TDD the whole time for development. Is this something that you&#8217;d be interested in?</p>


<p>Related posts:<ol><li><a href='http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/' rel='bookmark' title='Permanent Link: Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC'>Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC</a></li><li><a href='http://joelhooks.com/2008/03/14/complex-datagrid-filterfunction-in-flexair/' rel='bookmark' title='Permanent Link: Complex DataGrid filterFunction in Flex/Air'>Complex DataGrid filterFunction in Flex/Air</a></li><li><a href='http://joelhooks.com/2008/02/09/vesession-flex-photography-studio-client-ordering-application/' rel='bookmark' title='Permanent Link: VEsession &#8211; Flex photography studio management and client ordering application'>VEsession &#8211; Flex photography studio management and client ordering application</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://joelhooks.com/2009/11/11/a-walkthrough-of-an-air-twitter-client-using-robotlegs-mvcs/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
<enclosure url="http://robotlegs.joelhooks.com/twit/rl_twitter.mov" length="116002274" type="video/quicktime" />
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>SlideshowPro Director via AMFPHP</title>
		<link>http://joelhooks.com/2009/09/27/slideshowpro-director-via-amfphp/</link>
		<comments>http://joelhooks.com/2009/09/27/slideshowpro-director-via-amfphp/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 21:13:36 +0000</pubDate>
		<dc:creator>Joel Hooks</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[remoting]]></category>

		<guid isPermaLink="false">http://joelhooks.com/?p=328</guid>
		<description><![CDATA[I really like SlideshowPro Director. With version 1.0.9.9 and below, you could simply access it as an XML service. This was great. Very fast. Past that they reworked the application and introduced an API. This is probably a good move for many, but the API is geared towards PHP websites that want to utilize SSP [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I really like <a href="http://slideshowpro.net/products/slideshowpro_director/slideshowpro_director">SlideshowPro Director</a>. With version 1.0.9.9 and below, you could simply access it as an XML service. This was great. Very fast. Past that they reworked the application and introduced an API. This is probably a good move for many, but the API is geared towards PHP websites that want to utilize SSP Director for html/js/css purposes. What I need to do is access the resources through Actionscript 3. My first thought was use <a href="http://www.amfphp.org/">AMFPHP</a> and simple access the API through PHP that way, but when accessing the API that way, it was dreadfully slow. It would pause while loading for a good 10 seconds sometimes. The overhead of the PHP backend and the API just don&#8217;t cut it for use as an Actionscript service.</p>
<p>The solution was to simply skip the middle man and go at the database directly. Now it is lightening fast using this AMFPHP service endpoint:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p328code26'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p32826"><td class="code" id="p328code26"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> GalleryService
<span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> GalleryService<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">methodTable</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span>
        <span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">&quot;getAlbumById&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span>
            <span style="color: #009900;">&#40;</span>
                <span style="color: #0000ff;">&quot;access&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;remote&quot;</span><span style="color: #339933;">,</span>
                <span style="color: #0000ff;">&quot;description&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Pings back a message&quot;</span>
            <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> getAlbumById<span style="color: #009900;">&#40;</span><span style="color: #000088;">$albumNumber</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$dbhost</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'YOUR_MYSQL_HOST'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$dbuser</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'YOUR_USER_NAME'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$dbpass</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'YOUR_PASSWORD'</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$dbname</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'YOUR_SSP_DATABASE_NAME'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$result_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$conn</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dbhost</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbuser</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbpass</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span>                      <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Error connecting to mysql'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$dbname</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'slideshow'</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dbname</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #666666; font-style: italic;">//be sure to guard against injection by casting the album id to int (thanks Shaun!)</span>
		<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM ssp_images WHERE aid=&quot;</span> <span style="color: #339933;">.</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$albumNumber</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$result_array</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'YOUR_PATH_TO_SSP_ROOT/albums/album-'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aid'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/lg/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'src'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #990000;">mysql_close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$result_array</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//an array of url strings</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>There are all sorts of options you could do for this. You could set up value objects and send those back to Flash. All I needed for my purposes was the array of url strings. Simple, fast, and effective. Now we can manage our galleries with Director, and are free from the constraints of the official SlideshowPro for presentation.</p>
<p>What I really want is an official AMF service through Director. They are using CakePHP, and there are AMF solutions for that. Hopefully that would supply a fast, officially sanctioned AMF solution. Until than, the above works just fine.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://joelhooks.com/2009/09/27/slideshowpro-director-via-amfphp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Robotlegs IoC/DI Flex Framework Examples Updated</title>
		<link>http://joelhooks.com/2009/08/14/robotlegs-iocdi-flex-framework-examples-updated/</link>
		<comments>http://joelhooks.com/2009/08/14/robotlegs-iocdi-flex-framework-examples-updated/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 19:32:51 +0000</pubDate>
		<dc:creator>Joel Hooks</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[object oriented concepts]]></category>
		<category><![CDATA[robotlegs]]></category>
		<category><![CDATA[software architecture]]></category>

		<guid isPermaLink="false">http://joelhooks.com/?p=314</guid>
		<description><![CDATA[Live demos are available on robotlegs.org here
Acme Widget Factory:
The Acme Widget Factory is modular example and deals with loading multiple modules into a shell and communicating between those modules. The shell and each module has its own context.
Lazy Stack:
Lazy Stack is an example of deferred instantiation of Flex components, and how this is handled by [...]


Related posts:<ol><li><a href='http://joelhooks.com/2008/01/21/flexunit-some-useful-examples-covering-unit-testing-in-flex-and-actionscript-30/' rel='bookmark' title='Permanent Link: FlexUnit &#8211; Some useful examples and tutorials covering unit testing in Flex and Actionscript 3.0'>FlexUnit &#8211; Some useful examples and tutorials covering unit testing in Flex and Actionscript 3.0</a></li><li><a href='http://joelhooks.com/2009/07/21/unit-testing-with-inversion-of-control-ioc-and-dependency-injection-di-with-the-robotlegs-framework-and-flexunit-4/' rel='bookmark' title='Permanent Link: Unit Testing: IoC/DI, Robotlegs and FlexUnit 4'>Unit Testing: IoC/DI, Robotlegs and FlexUnit 4</a></li><li><a href='http://joelhooks.com/2008/02/07/flex-preventing-datagrid-scrolling-when-the-dataprovider-is-updated/' rel='bookmark' title='Permanent Link: Flex &#8211; Preventing DataGrid scrolling when the dataprovider is updated.'>Flex &#8211; Preventing DataGrid scrolling when the dataprovider is updated.</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Live demos are available on <a href="http://www.robotlegs.org/examples/">robotlegs.org here</a></p>
<p>Acme Widget Factory:<br />
The Acme Widget Factory is modular example and deals with loading multiple modules into a shell and communicating between those modules. The shell and each module has its own context.</p>
<p>Lazy Stack:<br />
Lazy Stack is an example of deferred instantiation of Flex components, and how this is handled by the Robotlegs framework.</p>
<p>Wheres Window:<br />
Where&#8217;s Window is a simple example to show how to mediate and communicate between a set of instances of the same view component that have individual mediators. In this case, the view components are windows in an AIR application. This uses a proxy to register and manage the currently open unique windows. I am going to write a more detailed breakdown of this particular example soon.</p>
<h2>The Elevator Pitch</h2>
<p><a href="http://github.com/darscan/robotlegs/tree/master">Robotlegs</a> is an IoC/DI container that is modeled on the PureMVC application structure. It is designed to be MVCS, model-view-controller-service, providing metadata dependency injection across these layers. While following the well organized approach of PureMVC, it eliminates the use of framework singletons and takes full advantage of the Flash Platform to keep the dreaded boiler plate code to a minimum. Eliminating these singletons makes unit testing and TDD much easier, which can be a real struggle when trying to isolate classes for testing where these singleton dependencies exist. Robotlegs is fast, clean, and perhaps more importantly fun to work with. There is a smorgasbord of architectural frameworks available for Flex/AS3, but Robotlegs is worth a look even if you are sick of looking at architectural frameworks.<br />
<a href="http://github.com/darscan/robotlegs/tree/master"><img class="aligncenter size-full wp-image-262" title="robotlegssketchsmall" src="http://joelhooks.com/wp-content/uploads/2009/07/robotlegssketchsmall.gif" alt="robotlegssketchsmall" width="221" height="260" /></a></p>


<p>Related posts:<ol><li><a href='http://joelhooks.com/2008/01/21/flexunit-some-useful-examples-covering-unit-testing-in-flex-and-actionscript-30/' rel='bookmark' title='Permanent Link: FlexUnit &#8211; Some useful examples and tutorials covering unit testing in Flex and Actionscript 3.0'>FlexUnit &#8211; Some useful examples and tutorials covering unit testing in Flex and Actionscript 3.0</a></li><li><a href='http://joelhooks.com/2009/07/21/unit-testing-with-inversion-of-control-ioc-and-dependency-injection-di-with-the-robotlegs-framework-and-flexunit-4/' rel='bookmark' title='Permanent Link: Unit Testing: IoC/DI, Robotlegs and FlexUnit 4'>Unit Testing: IoC/DI, Robotlegs and FlexUnit 4</a></li><li><a href='http://joelhooks.com/2008/02/07/flex-preventing-datagrid-scrolling-when-the-dataprovider-is-updated/' rel='bookmark' title='Permanent Link: Flex &#8211; Preventing DataGrid scrolling when the dataprovider is updated.'>Flex &#8211; Preventing DataGrid scrolling when the dataprovider is updated.</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://joelhooks.com/2009/08/14/robotlegs-iocdi-flex-framework-examples-updated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Unit Testing: IoC/DI, Robotlegs and FlexUnit 4</title>
		<link>http://joelhooks.com/2009/07/21/unit-testing-with-inversion-of-control-ioc-and-dependency-injection-di-with-the-robotlegs-framework-and-flexunit-4/</link>
		<comments>http://joelhooks.com/2009/07/21/unit-testing-with-inversion-of-control-ioc-and-dependency-injection-di-with-the-robotlegs-framework-and-flexunit-4/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 06:08:24 +0000</pubDate>
		<dc:creator>Joel Hooks</dc:creator>
				<category><![CDATA[FlexUnit]]></category>
		<category><![CDATA[Unit Testing]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[object oriented concepts]]></category>
		<category><![CDATA[robotlegs]]></category>

		<guid isPermaLink="false">http://joelhooks.com/?p=283</guid>
		<description><![CDATA[I&#8217;ve been reviewing the various IoC containers available for Flex/Actionscript. One of the benefits of IoC and DI is that it greatly facilitates unit testing. By injecting our dependencies into our applications actors, we are effectively isolating them from the other classes that make the application function. &#8220;So what?&#8221;
In computer programming, unit testing is a [...]


Related posts:<ol><li><a href='http://joelhooks.com/2008/01/21/flexunit-some-useful-examples-covering-unit-testing-in-flex-and-actionscript-30/' rel='bookmark' title='Permanent Link: FlexUnit &#8211; Some useful examples and tutorials covering unit testing in Flex and Actionscript 3.0'>FlexUnit &#8211; Some useful examples and tutorials covering unit testing in Flex and Actionscript 3.0</a></li><li><a href='http://joelhooks.com/2009/08/14/robotlegs-iocdi-flex-framework-examples-updated/' rel='bookmark' title='Permanent Link: Robotlegs IoC/DI Flex Framework Examples Updated'>Robotlegs IoC/DI Flex Framework Examples Updated</a></li><li><a href='http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/' rel='bookmark' title='Permanent Link: Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC'>Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been reviewing the various IoC containers available for Flex/Actionscript. One of the benefits of IoC and DI is that it greatly facilitates unit testing. By injecting our dependencies into our applications actors, we are effectively isolating them from the other classes that make the application function. &#8220;So what?&#8221;</p>
<blockquote><p>In computer programming, unit testing is a software verification and validation method in which a programmer tests that individual units of source code are fit for use. A unit is the smallest testable part of an application. In procedural programming a unit may be an individual program, function, procedure, etc., while in object-oriented programming, the smallest unit is a class, which may belong to a base/super class, abstract class or derived/child class.</p>
<p>Ideally, each test case is independent from the others: substitutes like method stubs, mock objects, fakes and test harnesses can be used to assist testing a module in isolation. Unit tests are typically written and run by software developers to ensure that code meets its design and behaves as intended. Its implementation can vary from being very manual (pencil and paper) to being formalized as part of build automation. -<a href="http://en.wikipedia.org/wiki/Unit_testing">wikipedia unit testing entry</a></p></blockquote>
<p>To effectively unit test classes, we want them to be as isolated as possible. The class needs to stand on its own and have its functionality vetted to ensure that it behaves as expected. When we start to test how our classes behave together, we have entered the land of <a href="http://en.wikipedia.org/wiki/Integration_testing">integration testing</a>. Integration testing is a worthwhile pursuit also, but before we get to that point, we really want to ensure that our classes are solid by themselves.</p>
<p>Using the example in this <a href="http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-–-inspired-by-puremvc/">Robotlegs Image Gallery demonstration</a>, we are going to test a couple of the classes that make up the application. The demo isn&#8217;t complex. It has a very simple model, a single service, and just a few views. In fact, it might even seem like a waste of time to unit test a simple example such as this, but the concepts are applicable to larger applications where the benefits of this type of testing really start to pay off.</p>
<p><a href="http://opensource.adobe.com/wiki/display/flexunit/FlexUnit+4+feature+overview">FlexUnit 4 is the framework</a> that is used here. It provides very handy asynchronous testing, meta data support, and a whole bucket of stellar features that I won&#8217;t even begin to scratch the surface of. FlexUnit 4 also comes with a graphical testrunner interface:</p>
<p><img class="aligncenter size-full wp-image-284" title="success" src="http://joelhooks.com/wp-content/uploads/2009/07/success.jpg" alt="success" width="450" height="277" /><br />
<span id="more-283"></span></p>
<h2>On to the code&#8230;</h2>
<p><a href="http://github.com/joelhooks/robotlegsdemos/tree/master">full source is here&#8230;</a></p>
<p>This test runner interface is added to the RobotlegsImageGalleryTestRunner.mxml application:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p283code31'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p28331"><td class="code" id="p283code31"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Application</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:fx</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:s</span>=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:mx</span>=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">xmlns:flexUnitUIRunner</span>=<span style="color: #ff0000;">&quot;http://www.adobe.com/2009/flexUnitUIRunner&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">creationComplete</span>=<span style="color: #ff0000;">&quot;onCreationComplete()&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:BasicLayout</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">			import org.robotlegs.demos.imagegallery.test.suites.RobotlegsImageGalleryTestSuite;</span>
<span style="color: #339933;">			import org.flexunit.listeners.UIListener;</span>
<span style="color: #339933;">			import org.flexunit.runner.FlexUnitCore;</span>
&nbsp;
<span style="color: #339933;">			private var core:FlexUnitCore;</span>
<span style="color: #339933;">			private function onCreationComplete():void</span>
<span style="color: #339933;">			{</span>
<span style="color: #339933;">				this.core = new FlexUnitCore();</span>
<span style="color: #339933;">				core.addListener( new UIListener( uiListener ));	</span>
<span style="color: #339933;">				core.run( RobotlegsImageGalleryTestSuite )</span>
<span style="color: #339933;">			}</span>
<span style="color: #339933;">		]]&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flexUnitUIRunner:TestRunnerBase</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;uiListener&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The core runs our test suites, in this case we are only running a single suite: the RobotlegsImageGalleryTestSuite. The test suite carries metadata that identifies it as a FlexUnit suite. There is no need to extend TestSuite as in previous version of FlexUnit:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p283code32'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p28332"><td class="code" id="p283code32"><pre class="actionscript" style="font-family:monospace;">package org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">demos</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">test</span>.<span style="color: #006600;">suites</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">demos</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">test</span>.<span style="color: #006600;">cases</span>.<span style="color: #006600;">TestFlickrService</span>;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">demos</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">test</span>.<span style="color: #006600;">cases</span>.<span style="color: #006600;">TestGalleryProxy</span>;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>Suite<span style="color: #66cc66;">&#93;</span>
	<span style="color: #66cc66;">&#91;</span>RunWith<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;org.flexunit.runners.Suite&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> RobotlegsImageGalleryTestSuite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> testFlickrService:TestFlickrService;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> testGalleryProxy:TestGalleryProxy;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>The suite further defines the test cases that we are going to run, TestFlickrService and TestGalleryProxy. Any other test cases would also be included in this suite. TestFlickrService extends the Robotlegs Service class. It makes an asyncronous call to the Flickr API and retrieves images via the &#8216;interestingness&#8217; category, as well as through a text search. The Service class has a dependency that is injected by the framework on its eventBroadcaster property. EventBroadcaster simply wraps an event dispatcher to provide a simplified interface for the framework to access. Service also provides a dispatch(event) convenience method for sending event notifications to the framework context. Our tests are not run within this context, however, so we have run into a problem. Since the framework injects the EventDispatcher into the EventBroadcaster automatically, we apparently have no way to access it and we can&#8217;t receive framework notifications.</p>
<p>As it happens, we can simply inject our dependencies manually. The TestFlickrService case has a serviceDispatcher property that extends EventDispatcher. In our setUp() method that is called prior to every test, we create a new EventBroadcaster (which takes our serviceDispatcher as an argument) and add it to our fresh FlickrImageService instance. Now the test case has access to the injected dispatcher, and we can listen for our normal flash events that Robotlegs uses for notifications.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p283code33'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p28333"><td class="code" id="p283code33"><pre class="actionscript" style="font-family:monospace;">package org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">demos</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">test</span>.<span style="color: #006600;">cases</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">EventDispatcher</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">flexunit</span>.<span style="color: #006600;">Assert</span>;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">flexunit</span>.<span style="color: #006600;">async</span>.<span style="color: #006600;">Async</span>;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">demos</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">events</span>.<span style="color: #006600;">GalleryEvent</span>;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">demos</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">remote</span>.<span style="color: #006600;">services</span>.<span style="color: #006600;">FlickrImageService</span>;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">mvcs</span>.<span style="color: #006600;">EventBroadcaster</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestFlickrService
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> service:FlickrImageService;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> serviceDispatcher:EventDispatcher = <span style="color: #000000; font-weight: bold;">new</span> EventDispatcher<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Before<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setUp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			serviceDispatcher = <span style="color: #000000; font-weight: bold;">new</span> EventDispatcher<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			service = <span style="color: #000000; font-weight: bold;">new</span> FlickrImageService<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			service.<span style="color: #006600;">eventBroadcaster</span> = <span style="color: #000000; font-weight: bold;">new</span> EventBroadcaster<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">serviceDispatcher</span><span style="color: #66cc66;">&#41;</span>;;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#91;</span>After<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> tearDown<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">serviceDispatcher</span> = <span style="color: #000000; font-weight: bold;">null</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">service</span>.<span style="color: #006600;">eventBroadcaster</span> = <span style="color: #000000; font-weight: bold;">null</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">service</span> = <span style="color: #000000; font-weight: bold;">null</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Test<span style="color: #66cc66;">&#40;</span>async<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testRetreiveImages<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">serviceDispatcher</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> GalleryEvent.<span style="color: #006600;">GALLERY_LOADED</span>, Async.<span style="color: #006600;">asyncHandler</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, handleImagesReceived, 3000, <span style="color: #000000; font-weight: bold;">null</span>, handleServiceTimeout<span style="color: #66cc66;">&#41;</span>, <span style="color: #000000; font-weight: bold;">false</span>, 0, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">service</span>.<span style="color: #006600;">loadGallery</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Test<span style="color: #66cc66;">&#40;</span>async<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testSearchImages<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">serviceDispatcher</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> GalleryEvent.<span style="color: #006600;">GALLERY_LOADED</span>, Async.<span style="color: #006600;">asyncHandler</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>, handleImagesReceived, 3000, <span style="color: #000000; font-weight: bold;">null</span>, handleServiceTimeout<span style="color: #66cc66;">&#41;</span>, <span style="color: #000000; font-weight: bold;">false</span>, 0, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">service</span>.<span style="color: #006600;">search</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;robotlegs&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> handleServiceTimeout<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">object</span>:<span style="color: #0066CC;">Object</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
	    	        Assert.<span style="color: #006600;">fail</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Pending Event Never Occurred'</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		protected <span style="color: #000000; font-weight: bold;">function</span> handleImagesReceived<span style="color: #66cc66;">&#40;</span>event:GalleryEvent, <span style="color: #0066CC;">object</span>:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			Assert.<span style="color: #006600;">assertEquals</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;The gallery should have some photos: &quot;</span>, event.<span style="color: #006600;">gallery</span>.<span style="color: #006600;">photos</span>.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&gt;</span> 0, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>	
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>After each test is run, our tearDown method is called by FlexUnit which sets our service and its eventBroadcaster to null in preparation for the next test in this case to be run. While this example isn&#8217;t very complex, it is easy to see how this could be extended to a much more complicated service.</p>
<p>The GalleryProxy class is tested in much the same way, though it doesn&#8217;t have any async methods:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p283code34'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p28334"><td class="code" id="p283code34"><pre class="actionscript" style="font-family:monospace;">package org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">demos</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">test</span>.<span style="color: #006600;">cases</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">flexunit</span>.<span style="color: #006600;">Assert</span>;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">demos</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">models</span>.<span style="color: #006600;">proxies</span>.<span style="color: #006600;">GalleryProxy</span>;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">demos</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">models</span>.<span style="color: #006600;">vo</span>.<span style="color: #006600;">Gallery</span>;
	<span style="color: #0066CC;">import</span> org.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">demos</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">models</span>.<span style="color: #006600;">vo</span>.<span style="color: #006600;">GalleryImage</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestGalleryProxy
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> galleryProxy:GalleryProxy;
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Before<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setUp<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">galleryProxy</span> = <span style="color: #000000; font-weight: bold;">new</span> GalleryProxy<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#91;</span>After<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> tearDown<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">galleryProxy</span> = <span style="color: #000000; font-weight: bold;">null</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Test<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testSetGallery<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> gallery:Gallery = <span style="color: #000000; font-weight: bold;">new</span> Gallery<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">galleryProxy</span>.<span style="color: #006600;">gallery</span> = gallery;
			Assert.<span style="color: #006600;">assertEquals</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;GalleryProxy should have a gallery&quot;</span>, <span style="color: #0066CC;">this</span>.<span style="color: #006600;">galleryProxy</span>.<span style="color: #006600;">gallery</span> <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#91;</span>Test<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> testSetSelectedImage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> image1:GalleryImage = <span style="color: #000000; font-weight: bold;">new</span> GalleryImage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">var</span> image2:GalleryImage = <span style="color: #000000; font-weight: bold;">new</span> GalleryImage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">var</span> gallery:Gallery = <span style="color: #000000; font-weight: bold;">new</span> Gallery<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">galleryProxy</span>.<span style="color: #006600;">gallery</span> = gallery;
			gallery.<span style="color: #006600;">photos</span>.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>image1<span style="color: #66cc66;">&#41;</span>;
			gallery.<span style="color: #006600;">photos</span>.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>image2<span style="color: #66cc66;">&#41;</span>;
			image1.<span style="color: #006600;">selected</span> = <span style="color: #000000; font-weight: bold;">false</span>;
			image2.<span style="color: #006600;">selected</span> = <span style="color: #000000; font-weight: bold;">true</span>;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">galleryProxy</span>.<span style="color: #006600;">setSelectedImage</span><span style="color: #66cc66;">&#40;</span>image1<span style="color: #66cc66;">&#41;</span>;
			Assert.<span style="color: #006600;">assertEquals</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Image1 should be selected&quot;</span>, image1.<span style="color: #006600;">selected</span>, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
			Assert.<span style="color: #006600;">assertEquals</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Image 2 should NOT be selected&quot;</span>, image2.<span style="color: #006600;">selected</span>, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>With these simple tests we are 100% certain that our classes function as expected on their own, completely isolated from the rest of the application.</p>
<h2>You really should call your mom&#8230;</h2>
<p>We are all unit testing our code and following strong Agile/TDD processes, right&#8230;. right? I don&#8217;t know how much unit testing is going on in the Flash/Flex world, but my guess that the overall test coverage percentage is very small. RIAs are here. They are becoming full fledged applications that <strong><em>people rely on to do business</em></strong>. There will come a time in your RIAs life that you will need to get in there and do some refactoring. It might be for performance, fixing bugs, or adding some new kickass feature to push your app to the next level. Fact, without unit testing:</p>
<blockquote><p><strong>you&#8217;re not refactoring; you&#8217;re just changing shit. -<a href="http://hamletdarcy.blogspot.com/2009/06/forgotten-refactorings.html">Hamlet D&#8217;Arcy</a></strong></p></blockquote>
<p>There are many, many arguments for unit testing your code, but for me this is the most compelling. At some point in the future, you are going to want to get in there and make some changes. If your application is important to your users, you want to make sure those changes don&#8217;t break everything. It is guaranteed that they will break something, the question is will you know immediately what happened, or at least where to look?</p>
<p>We are getting the proper tools for the job. FlexUnit 4 is an incredible project. There is a robust selection of frameworks that all have merits and can facilitate structured, well designed applications. I&#8217;m personally out of excuses. I want to develop applications that my users can trust and rely on to do business, and unit testing is a part of that recipe.</p>


<p>Related posts:<ol><li><a href='http://joelhooks.com/2008/01/21/flexunit-some-useful-examples-covering-unit-testing-in-flex-and-actionscript-30/' rel='bookmark' title='Permanent Link: FlexUnit &#8211; Some useful examples and tutorials covering unit testing in Flex and Actionscript 3.0'>FlexUnit &#8211; Some useful examples and tutorials covering unit testing in Flex and Actionscript 3.0</a></li><li><a href='http://joelhooks.com/2009/08/14/robotlegs-iocdi-flex-framework-examples-updated/' rel='bookmark' title='Permanent Link: Robotlegs IoC/DI Flex Framework Examples Updated'>Robotlegs IoC/DI Flex Framework Examples Updated</a></li><li><a href='http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/' rel='bookmark' title='Permanent Link: Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC'>Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://joelhooks.com/2009/07/21/unit-testing-with-inversion-of-control-ioc-and-dependency-injection-di-with-the-robotlegs-framework-and-flexunit-4/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Robotlegs AS3: A Dependency Injection Driven MVCS Framework for Flash/Flex – Inspired by PureMVC</title>
		<link>http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/</link>
		<comments>http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 20:39:46 +0000</pubDate>
		<dc:creator>Joel Hooks</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[robotlegs]]></category>
		<category><![CDATA[software architecture]]></category>

		<guid isPermaLink="false">http://joelhooks.com/?p=259</guid>
		<description><![CDATA[robotlegs.org
robotlegs best practices 
The quest for a Dependency Injection container continues. The most recent stop on this exploration of the available options has been Robotlegs. Robotlegs AS3 is a DI driven MVCS framework for Flash/Flex inspired by PureMVC. Being a huge fan of PureMVC, this caught my attention immediately. Robotlegs professes to be a framework [...]


Related posts:<ol><li><a href='http://joelhooks.com/2009/07/14/inversion-of-control-and-dependency-injection-with-flex-using-the-parsley-application-framework-part-2/' rel='bookmark' title='Permanent Link: Inversion of Control and Dependency Injection with Flex using the Parsley Application Framework &#8211; Part 2'>Inversion of Control and Dependency Injection with Flex using the Parsley Application Framework &#8211; Part 2</a></li><li><a href='http://joelhooks.com/2008/03/25/renju-flex-board-game-built-with-the-puremvc-framework/' rel='bookmark' title='Permanent Link: Renju &#8211; AS3 board game built with the PureMVC framework.'>Renju &#8211; AS3 board game built with the PureMVC framework.</a></li><li><a href='http://joelhooks.com/2009/07/12/inversion-of-control-and-dependency-injection-in-flex-using-the-parsley-application-framework-part-1/' rel='bookmark' title='Permanent Link: Inversion of Control and Dependency Injection in Flex using the Parsley Application Framework &#8211; Part 1'>Inversion of Control and Dependency Injection in Flex using the Parsley Application Framework &#8211; Part 1</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.robotlegs.org">robotlegs.org</a></p>
<p><a href="http://wiki.github.com/robotlegs/robotlegs-framework/best-practices">robotlegs best practices </a></p>
<p>The quest for a Dependency Injection container continues. The most recent stop on this exploration of the available options has been Robotlegs. Robotlegs AS3 is a DI driven MVCS framework for Flash/Flex inspired by PureMVC. Being a huge fan of PureMVC, this caught my attention immediately. Robotlegs professes to be a framework like PureMVC, but without all the Singeltons, Service Locators, casting and boiler plate we have all come to love. Better yet, it delivers on these claims.</p>
<p><a href="http://github.com/joelhooks/robotlegsdemos/tree/master">Source for this demo available on github&#8230; </a></p>
<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_RobotlegsFlickrGallery_870566667"
			class="flashmovie"
			width="520"
			height="675">
	<param name="movie" value="http://joelhooks.com/examples/robotlegsGallery/RobotlegsFlickrGallery.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://joelhooks.com/examples/robotlegsGallery/RobotlegsFlickrGallery.swf"
			name="fm_RobotlegsFlickrGallery_870566667"
			width="520"
			height="675">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object></div>
<p><span id="more-259"></span></p>
<h2>Brief Code Walkthrough</h2>
<p>I&#8217;m using the same gallery example I used for Parsley, with some enhancements. The basic structure is like a typical PureMVC application. We&#8217;ve divided our packages up into model, view, controller, and events. Instead of extending Facade to bootstrap our application we need to instantiate a Context in our Applications main mxml/as file:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p259code40'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p25940"><td class="code" id="p259code40"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> com.<span style="color: #006600;">joelhooks</span>.<span style="color: #006600;">robotlegs</span>.<span style="color: #006600;">demos</span>.<span style="color: #006600;">imagegallery</span>.<span style="color: #006600;">ImageGalleryContext</span>;
<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">FlexEvent</span>;
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> galleryContext:ImageGalleryContext;
&nbsp;
protected <span style="color: #000000; font-weight: bold;">function</span> creationCompleteHandler<span style="color: #66cc66;">&#40;</span>event:FlexEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">this</span>.<span style="color: #006600;">galleryContext</span> = <span style="color: #000000; font-weight: bold;">new</span> ImageGalleryContext<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">this</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>The Context defines which IoC adapter to use (currently SmartyPants-IoC is the only available adapter, but a SpringAS adapter is in the works). It also fires its startup method which registers a series of commands and dispatches a Startup event.</p>
<p>The Context for the application defines a series of Commands to fire in sequence to get the application</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p259code41'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p25941"><td class="code" id="p259code41"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ImageGalleryContext <span style="color: #0066CC;">extends</span> Context
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> ImageGalleryContext<span style="color: #66cc66;">&#40;</span>contextView:DisplayObjectContainer<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span> contextView, <span style="color: #000000; font-weight: bold;">new</span> SmartyPantsInjector<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> SmartyPantsReflector<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #808080; font-style: italic;">// Keep SmartyPants quiet</span>
		NoSmartyPantsLogging;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> startup<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">// Map our startup commands</span>
		commandFactory.<span style="color: #006600;">mapCommand</span><span style="color: #66cc66;">&#40;</span> ContextEvent.<span style="color: #006600;">STARTUP</span>, PrepModelCommand, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
		commandFactory.<span style="color: #006600;">mapCommand</span><span style="color: #66cc66;">&#40;</span> ContextEvent.<span style="color: #006600;">STARTUP</span>, PrepServicesCommand, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
		commandFactory.<span style="color: #006600;">mapCommand</span><span style="color: #66cc66;">&#40;</span> ContextEvent.<span style="color: #006600;">STARTUP</span>, PrepViewCommand, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
		commandFactory.<span style="color: #006600;">mapCommand</span><span style="color: #66cc66;">&#40;</span> ContextEvent.<span style="color: #006600;">STARTUP</span>, StartupCommand, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #808080; font-style: italic;">// And away we go!</span>
		eventBroadcaster.<span style="color: #006600;">dispatchEvent</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> ContextEvent<span style="color: #66cc66;">&#40;</span> ContextEvent.<span style="color: #006600;">STARTUP</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>These Commands are very similar to PureMVC commands. The Startup commands are used to define the initial injected classes and relationships between view components and their mediators.</p>
<p>Mediation is particularly sweet with Robotlegs. Once a view component has been associated with a mediator, it will be registered automatically:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p259code42'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p25942"><td class="code" id="p259code42"><pre class="actionscript" style="font-family:monospace;">mediatorFactory.<span style="color: #006600;">mapMediator</span><span style="color: #66cc66;">&#40;</span> GalleryView, GalleryViewMediator <span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>avoiding the need for facade.registerMediator&#8230; as well as skipping around the deferred instantiation/lifecycle issues that plague Flex applications. because we are injecting into our mediators, there is no need to have the mediator ask for its dependencies. We tell it what it needs and it does its work with what it is provided:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p259code43'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p25943"><td class="code" id="p259code43"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> GalleryViewMediator <span style="color: #0066CC;">extends</span> Mediator
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> galleryView:GalleryView;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> galleryProxy:GalleryProxy;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>Inject<span style="color: #66cc66;">&#93;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> imageService:IGalleryImageServiceDelegate;</pre></td></tr></table></div>

<p>Mediating view components is hands down my favorite aspect of PureMVC, and Robotlegs enhances that pattern by removing the egregious boiler plate. It allows my view components to be completely isolated and ignorant of the surrounding framework. I don&#8217;t want to inject data directly into the components or bind them to the Model. They need to display information to and collect input from the user.</p>
<p>Robotlegs has eliminated the Notifications of PureMVC, using AS3 events instead. Most of the current crop of IoC containers for Actionscript do this also, but Robotlegs has avoided using the Display List as the Event Bus or requiring a central Event Map. This is huge. There are no confusing issues with bubbling, or the need to pass around a reference to THE view component.</p>
<p>from the GalleryViewMediator.as:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p259code44'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p25944"><td class="code" id="p259code44"><pre class="actionscript" style="font-family:monospace;">override <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> onRegisterComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	addEventListenerTo<span style="color: #66cc66;">&#40;</span> galleryView, GalleryImageEvent.<span style="color: #006600;">SELECT_GALLERY_IMAGE</span>, onImageSelected <span style="color: #66cc66;">&#41;</span>
	addEventListenerTo<span style="color: #66cc66;">&#40;</span> eventDispatcher, GalleryEvent.<span style="color: #006600;">GALLERY_LOADED</span>, onGalleryLoaded <span style="color: #66cc66;">&#41;</span>
	<span style="color: #0066CC;">this</span>.<span style="color: #006600;">imageService</span>.<span style="color: #006600;">loadGallery</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>The core Robotlegs classes have an eventDispatcher that is the central event management aperatus. You then dispatch events using the dispatch() method on Proxy, Mediator, and Command classes and any interested party will respond.</p>
<h2>ANOTHER micro-architecture framework?!</h2>
<p>Well, yes. Shaun makes <a href="http://shaun.boyblack.co.za/blog/2009/04/29/another-architectural-framework-but-why/">several compelling arguments</a> for pursuing another framework. I personally like options. A full toolbox. The landscape of AS3/Flex frameworks is looking mighty fine, with players to suit almost any style and approach. Instead of griping about the deficits in the available architectural frameworks, he&#8217;s made an attempt to bring the good parts of the available frameworks together while eliminating the various anti-patterns that caused him grief.</p>
<p>I haven&#8217;t made much of an effort to conceal the fact that <a href="http://joelhooks.com/2008/03/15/5-reasons-puremvc-kicks-ass/">I am very much a PureMVC fan boy</a>. I like the structure, I like mediating my views as a mechanism for separation of responsibilities, and cliff Hall is one helluva guy. This isn&#8217;t to say that PureMVC doesn&#8217;t have its faults. The 4 Singletons that comprise the heart of the System, namely Facade, Model, View and Controller make for some difficult testing. The boiler plate is tedious, though at this point I just blindly type it, use a generator,  or use <a href="http://www.smileonmymac.com/TextExpander/">TextExpander</a>. None of these have been deal breakers for me, and I have worked on half a dozen large scale production projects with PureMVC. All of them have been succesful, scaled well, and were easy to manage from a development perspective.</p>
<p>That said, given the opportunity to eliminate the drawbacks of PureMVC, while still retaining the scalability and general workflow, I am all over it.</p>
<h2>Sounds great, what&#8217;s the catch?</h2>
<p>Robotlegs actively defines a PureMVC style MVC structure to your application.  You are extending framework classes with your actors instead of using plain-old-actionscript objects. Other frameworks avoid this, but at the cost of convenience in a lot of cases. If you like the PureMVC structure, this isn&#8217;t going to be a big deal. If you hate it, you might hate Robotlegs (but should give it a try anyway). Robotlegs has done a great job of reducing the pain involved by addressing the major complaints that I&#8217;ve seen publicly in various critiques of PureMVC.</p>
<div class="note-block">Be sure to check out <a href="#comment-12885020">Shaun&#8217;s response</a> to these items in the comments below.</div>
<p>Robotlegs is still very young and hasn&#8217;t been thoroughly peer reviewed. My guess is that you will start to hear more about this framework soon. It is already kickass, even at this early stage. Certainly one to keep your eye on.</p>
<div class="note-block">As of now Robotlegs has been receiving a lot of peer review and input. At the .9 release it is approaching razor sharpness</div>
<p><img class="aligncenter size-full wp-image-262" title="robotlegssketchsmall" src="http://joelhooks.com/wp-content/uploads/2009/07/robotlegssketchsmall.gif" alt="robotlegssketchsmall" width="221" height="260" /></p>
<p>Resources:<br />
<a href="http://groups.google.com/group/robotlegs">Robolegs Google Group</a><br />
<a href="http://shaun.boyblack.co.za/blog/2009/06/17/robotlegs-as3-introductory-screencast/">Robolegs Screencasts</a><br />
<a href="http://github.com/darscan/robotlegs/tree/master">Robolegs Source</a></p>


<p>Related posts:<ol><li><a href='http://joelhooks.com/2009/07/14/inversion-of-control-and-dependency-injection-with-flex-using-the-parsley-application-framework-part-2/' rel='bookmark' title='Permanent Link: Inversion of Control and Dependency Injection with Flex using the Parsley Application Framework &#8211; Part 2'>Inversion of Control and Dependency Injection with Flex using the Parsley Application Framework &#8211; Part 2</a></li><li><a href='http://joelhooks.com/2008/03/25/renju-flex-board-game-built-with-the-puremvc-framework/' rel='bookmark' title='Permanent Link: Renju &#8211; AS3 board game built with the PureMVC framework.'>Renju &#8211; AS3 board game built with the PureMVC framework.</a></li><li><a href='http://joelhooks.com/2009/07/12/inversion-of-control-and-dependency-injection-in-flex-using-the-parsley-application-framework-part-1/' rel='bookmark' title='Permanent Link: Inversion of Control and Dependency Injection in Flex using the Parsley Application Framework &#8211; Part 1'>Inversion of Control and Dependency Injection in Flex using the Parsley Application Framework &#8211; Part 1</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://joelhooks.com/2009/07/17/robotlegs-as3-a-dependency-injection-driven-mvcs-framework-for-flashflex-%e2%80%93-inspired-by-puremvc/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
	</channel>
</rss>
