<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Footprints blog</title>
	<atom:link href="http://blog.codedrunks.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.codedrunks.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 04 Dec 2009 19:02:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Hello world!</title>
		<link>http://blog.codedrunks.com/?p=1</link>
		<comments>http://blog.codedrunks.com/?p=1#comments</comments>
		<pubDate>Fri, 04 Dec 2009 19:02:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http:/?p=1</guid>
		<description><![CDATA[Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
]]></description>
			<content:encoded><![CDATA[<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codedrunks.com/?feed=rss2&amp;p=1</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using respondTo and reactTo</title>
		<link>http://blog.codedrunks.com/?p=160</link>
		<comments>http://blog.codedrunks.com/?p=160#comments</comments>
		<pubDate>Sat, 07 Feb 2009 15:56:42 +0000</pubDate>
		<dc:creator>Darshan Sawardekar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Fabrication]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[reactTo]]></category>
		<category><![CDATA[respondTo]]></category>

		<guid isPermaLink="false">http://www.codedrunks.com/?p=160</guid>
		<description><![CDATA[Marcel has written a very thorough article which takes a look at a two Fabrication features that help to reduce the boilerplate in PureMVC Mediators, Reflexive Notification Interests and Reactions.
Reflexive Notification Interests allow you to implement the act of indicating notification interests and reacting to them in handleNotification in a single step via respondToNote syntax. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://codeofdoom.com/wordpress/">Marcel</a> has written a <a href="http://codeofdoom.com/wordpress/2009/01/27/fabrication-puremvc-cleaned-up/">very thorough article</a> which takes a look at a two Fabrication features that help to reduce the boilerplate in PureMVC Mediators, <a href="http://code.google.com/p/fabrication/wiki/ReflexiveNotificationInterests">Reflexive Notification Interests</a> and <a href="http://code.google.com/p/fabrication/wiki/Reactions">Reactions</a>.</p>
<p><span id="more-160"></span>Reflexive Notification Interests allow you to implement the act of indicating notification interests and reacting to them in handleNotification in a single step via respondToNote syntax. Instead of writing a long switch case statements, individual respondTo methods are used. Similarly, the reactTo syntax does the same thing for events. Thanks Marcel, Nice to see an indepth and objective look at Fabrication.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codedrunks.com/?feed=rss2&amp;p=160</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Fabrication 0.6</title>
		<link>http://blog.codedrunks.com/?p=156</link>
		<comments>http://blog.codedrunks.com/?p=156#comments</comments>
		<pubDate>Fri, 09 Jan 2009 10:38:33 +0000</pubDate>
		<dc:creator>Darshan Sawardekar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Fabrication]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[Flex Component]]></category>
		<category><![CDATA[Interceptor]]></category>
		<category><![CDATA[Reactions]]></category>

		<guid isPermaLink="false">http://www.codedrunks.com/?p=156</guid>
		<description><![CDATA[I have finally(!) gotten around to releasing Fabricaton 0.6. This release adds a couple of important new features, Interceptors and Reactions.
Interceptors allow means to alter the normal flow of PureMVC notifications. You can drop notification, change their payload, or send completely different notification in its place, all before they reach the rest of the PureMVC [...]]]></description>
			<content:encoded><![CDATA[<p>I have finally(!) gotten around to releasing Fabricaton 0.6. This release adds a couple of important new features, Interceptors and Reactions.</p>
<p><span id="more-156"></span>Interceptors allow means to alter the normal flow of PureMVC notifications. You can drop notification, change their payload, or send completely different notification in its place, all before they reach the rest of the PureMVC actors, Mediators and Commands. See the <a href="http://code.google.com/p/fabrication/wiki/Interceptors">wiki page for Interceptors</a> for more details.</p>
<p>Reactions bring a <em>respondTo</em> like convention to mediators for handling component events automatically. <em>A reactToMyComponentFooEvent </em>indicates interest in the <em>FooEvent </em>of the <em>MyComponent </em>and its handler function at the same time. See the <a href="http://code.google.com/p/fabrication/wiki/Reactions">wiki page for Reactions</a> for more details.</p>
<p><a href="http://code.google.com/p/fabrication/wiki/ChangeLog">ChangeLog</a> of what has changed in this release.<br />
<a href="http://code.google.com/p/fabrication/downloads/list">Download Fabrication 0.6</a>.</p>
<p>Happy New Year Everyone!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codedrunks.com/?feed=rss2&amp;p=156</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Minor Update &#8211; 0.5.2</title>
		<link>http://blog.codedrunks.com/?p=149</link>
		<comments>http://blog.codedrunks.com/?p=149#comments</comments>
		<pubDate>Sat, 15 Nov 2008 13:17:49 +0000</pubDate>
		<dc:creator>Darshan Sawardekar</dc:creator>
				<category><![CDATA[Fabrication]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>

		<guid isPermaLink="false">http://www.codedrunks.com/?p=149</guid>
		<description><![CDATA[I have fixed a small bug with the FabricationView. It was throwing an error when unloading modules. You can grab 0.5.2 from here.
]]></description>
			<content:encoded><![CDATA[<p>I have fixed a small bug with the FabricationView. It was throwing an error when unloading modules. You can grab 0.5.2 from <a href="http://code.google.com/p/fabrication/downloads/list">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codedrunks.com/?feed=rss2&amp;p=149</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Minor Update &#8211; 0.5.1</title>
		<link>http://blog.codedrunks.com/?p=146</link>
		<comments>http://blog.codedrunks.com/?p=146#comments</comments>
		<pubDate>Wed, 12 Nov 2008 15:46:54 +0000</pubDate>
		<dc:creator>Darshan Sawardekar</dc:creator>
				<category><![CDATA[Fabrication]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[PureMVC Fabrication Flex 0.5.1]]></category>

		<guid isPermaLink="false">http://www.codedrunks.com/?p=146</guid>
		<description><![CDATA[The ComponentRouteMapper refactoring in the 0.5 release got added to FabricationMediator instead of the FlexMediator, where it should belong since it is a Flex specific feature. I have fixed this in 0.5.1, by moving it into its right place, in the FlexMediator.
Grab it here
http://code.google.com/p/fabrication/downloads/list
]]></description>
			<content:encoded><![CDATA[<p>The ComponentRouteMapper refactoring in the 0.5 release got added to FabricationMediator instead of the FlexMediator, where it should belong since it is a Flex specific feature. I have fixed this in 0.5.1, by moving it into its right place, in the FlexMediator.</p>
<p>Grab it here<br />
<a href="http://code.google.com/p/fabrication/downloads/list">http://code.google.com/p/fabrication/downloads/list</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codedrunks.com/?feed=rss2&amp;p=146</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fabrication 0.5 released &#8211; The Units Tests are in(427 of them)!</title>
		<link>http://blog.codedrunks.com/?p=140</link>
		<comments>http://blog.codedrunks.com/?p=140#comments</comments>
		<pubDate>Tue, 11 Nov 2008 18:01:09 +0000</pubDate>
		<dc:creator>Darshan Sawardekar</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Fabrication]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[PureMVC Fabrication 0.5 unit test custom routeNotification]]></category>

		<guid isPermaLink="false">http://www.codedrunks.com/?p=140</guid>
		<description><![CDATA[I have finally managed to bring the units test in sync with the Fabrication releases. It has been a pretty hectic last week or so, But I am really happy to have wrapped this up. With 400+ tests and extensive code coverage, Fabrication is now much better positioned to make future releases and fix bugs.

You [...]]]></description>
			<content:encoded><![CDATA[<p>I have finally managed to bring the units test in sync with the Fabrication releases. It has been a pretty hectic last week or so, But I am really happy to have wrapped this up. With 400+ tests and extensive code coverage, Fabrication is now much better positioned to make future releases and fix bugs.</p>
<p><span id="more-140"></span></p>
<p>You can check out the test runner below,<br />
<a href="http://fabrication.googlecode.com/svn/framework/trunk/bin/index.html">Fabrication Test Runner</a></p>
<p>The unit tests have proved to be very useful so far. I have been able to identify some really hard to find issues that had gone unnoticed until now. Fabrication is now updated to 0.5. Here is a list of what got changed,</p>
<ol>
<li>Fixed memory leaks within the framework. The <a href="http://fabrication.googlecode.com/svn/examples/simple_routing/bin/index.html">simple_routing example</a> is updated to show this in action.</li>
<li>Fixed incorrect component route caching.</li>
<li>Refactored ComponentRouteMapper object to be cached at the facade level instead of globally.</li>
<li>Fixed incorrect notification caching in the FabricationMediator.</li>
<li>Refactored message routing internals to use an explicit TransportNotification instead of the earlier dynamic implementation.</li>
<li>Added FabricationModel to improve garbage collection of proxies.</li>
<li>Added FabricationView to improve garbage collections of mediators(Thanks Jason).
</li>
<li>Added HashMap object to implement consistent cache management throughout the framework.
</li>
<li>Implemented IDisposable in nearly all classes in the framework.
</li>
<li>routeNotification now supports typed notifications with the syntax, routeNotification(new CustomNotification(&#8220;foo&#8221;))</li>
<li>Fixed invalid auto description regular expression in SimpleUndoableCommand.</li>
<li>FabricationFacade now provides a standard caching api to store objects within the scope of a facade instance.</li>
<li>Added platform specific swcs for flex and air.</li>
<li>Moved the build system into the framework and updated example builds.</li>
</ol>
<p>Grab the swcs and sources from Google code.<br />
<a href="http://code.google.com/p/fabrication/downloads/list">http://code.google.com/p/fabrication/downloads/list</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codedrunks.com/?feed=rss2&amp;p=140</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Minor Update &#8211; 0.4.3</title>
		<link>http://blog.codedrunks.com/?p=135</link>
		<comments>http://blog.codedrunks.com/?p=135#comments</comments>
		<pubDate>Wed, 29 Oct 2008 14:23:09 +0000</pubDate>
		<dc:creator>Darshan Sawardekar</dc:creator>
				<category><![CDATA[Fabrication]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[0.4.3]]></category>
		<category><![CDATA[route]]></category>

		<guid isPermaLink="false">http://www.codedrunks.com/?p=135</guid>
		<description><![CDATA[Fabrication is now updated to 0.4.3. There was a bug introduced in 0.4.2 with regards to a global (*) route being interpreted as a */INPUT route. This release fixes this bug.

Download 0.4.3 swc
Download 0.4.3 source zip
Thanks Jason for the fix.
]]></description>
			<content:encoded><![CDATA[<p>Fabrication is now updated to 0.4.3. There was a bug introduced in 0.4.2 with regards to a global (*) route being interpreted as a */INPUT route. This release fixes this bug.</p>
<p><!–more–></p>
<p><a href="http://fabrication.googlecode.com/files/fabrication-0.4.3.swc">Download 0.4.3 swc</a></p>
<p><a href="http://fabrication.googlecode.com/files/fabrication-0.4.3-src.zip">Download 0.4.3 source zip</a></p>
<p>Thanks Jason for the fix.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codedrunks.com/?feed=rss2&amp;p=135</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Minor Update &#8211; 0.4.2</title>
		<link>http://blog.codedrunks.com/?p=124</link>
		<comments>http://blog.codedrunks.com/?p=124#comments</comments>
		<pubDate>Wed, 22 Oct 2008 07:51:58 +0000</pubDate>
		<dc:creator>Darshan Sawardekar</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Fabrication]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[routeNotification]]></category>

		<guid isPermaLink="false">http://www.codedrunks.com/?p=124</guid>
		<description><![CDATA[I have updated Fabrication to 0.4.2. This version adds,

routeNotification now supports dynamic to arguments. The to parameter can now take moduleAddress objects as well as string routes.
Added expansion property to FabricationProxy to allow turning off of the default notification expansion of for custom named proxies.

Check it out here
]]></description>
			<content:encoded><![CDATA[<p>I have updated Fabrication to 0.4.2. This version adds,</p>
<ol>
<li>routeNotification now supports dynamic <strong>to</strong> arguments. The to parameter can now take moduleAddress objects as well as string routes.</li>
<li>Added <strong>expansion </strong>property to FabricationProxy to allow turning off of the default notification expansion of for custom named proxies.</li>
</ol>
<p>Check it out <a href="http://code.google.com/p/fabrication/downloads/list">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codedrunks.com/?feed=rss2&amp;p=124</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Minor update &#8211; 0.4.1</title>
		<link>http://blog.codedrunks.com/?p=121</link>
		<comments>http://blog.codedrunks.com/?p=121#comments</comments>
		<pubDate>Tue, 21 Oct 2008 12:46:10 +0000</pubDate>
		<dc:creator>Darshan Sawardekar</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Fabrication]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[ModuleManager]]></category>

		<guid isPermaLink="false">http://www.codedrunks.com/?p=121</guid>
		<description><![CDATA[I have updated Fabrication to 0.4.1. This includes a minor fix to the FlexModule to support loading directly via the ModuleManager. If your are not using the FlexModuleLoader then you need to set the router and defaultRoute in your module&#8217;s ready handler. I have added an example project to showcase this. Check it out here.

The [...]]]></description>
			<content:encoded><![CDATA[<p>I have updated Fabrication to 0.4.1. This includes a minor fix to the FlexModule to support loading directly via the ModuleManager. If your are not using the FlexModuleLoader then you need to set the router and defaultRoute in your module&#8217;s ready handler. I have added an example project to showcase this. Check it out <a href="http://fabrication.googlecode.com/svn/examples/simple_routing_with_module_manager">here</a>.<br />
<span id="more-121"></span><br />
The loading and ready handler from this example are shown below,</p>
<pre lang="actionscript3">
private function loadModule(moduleDescriptor:ModuleDescriptor):void {
	var module:IModuleInfo = ModuleManager.getModule(moduleDescriptor.url);

	module.data = moduleDescriptor;
	module.addEventListener(ModuleEvent.READY, moduleReadyListener);

	pendingModules.push(module);
	module.load(ApplicationDomain.currentDomain);
}

private function moduleReadyListener(event:ModuleEvent):void {
	var module:IModuleInfo = event.module;
	var moduleDescriptor:ModuleDescriptor = event.module.data as ModuleDescriptor;
	var moduleInstance:Object = event.module.factory.create();

	moduleInstance.router = applicationRouter;
	moduleInstance.defaultRouteAddress = applicationAddress;
	moduleInstance.id = moduleDescriptor.getElementID();

	moduleInstance.addEventListener(FabricatorEvent.FABRICATION_CREATED, moduleCreated);
	moduleInstance.addEventListener(FabricatorEvent.FABRICATION_REMOVED, moduleRemoved);

	modulesContainer.addChild(moduleInstance as DisplayObject);
}
</pre>
<p>Thanks to Ruben from the PureMVC forums for reporting this issue. You can download Fabrication 0.4.1 from <a href="http://code.google.com/p/fabrication/downloads/list">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codedrunks.com/?feed=rss2&amp;p=121</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Slacker &#8211; Post Fabrication</title>
		<link>http://blog.codedrunks.com/?p=112</link>
		<comments>http://blog.codedrunks.com/?p=112#comments</comments>
		<pubDate>Mon, 20 Oct 2008 12:50:35 +0000</pubDate>
		<dc:creator>Darshan Sawardekar</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Fabrication]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PureMVC]]></category>
		<category><![CDATA[deferred instantiation]]></category>
		<category><![CDATA[Slacker]]></category>

		<guid isPermaLink="false">http://www.codedrunks.com/?p=112</guid>
		<description><![CDATA[With the release of Fabrication 0.4, I thought it would be a useful to review the Slacker example in more detail. If are not familiar with the Slacker example, check it out here first. This example will help showcase the reduction of glue code from a PureMVC application using Fabrication.

I am going to focus on [...]]]></description>
			<content:encoded><![CDATA[<p>With the release of Fabrication 0.4, I thought it would be a useful to review the Slacker example in more detail. If are not familiar with the Slacker example, check it out <a href="http://puremvc.org/content/view/92/1/">here</a> first. This example will help showcase the reduction of glue code from a PureMVC application using Fabrication.</p>
<p><span id="more-112"></span></p>
<p>I am going to focus on 2 specific pieces of the Slacker Demo. The MainDisplayMediator.as class and the corresponding MainDisplay.mxml component. The main work of the demo happens in these classes. The rest of code deals with triggering notifications to change the selected child view, and is unchanged.</p>
<p>The MainDisplay component contains the child components, GalleryView, EditorView, and ProfileView inside a ViewStack. The view stack is set to use deferred instantiation with the creationPolicy, auto. Each of the children of the ViewStack send a custom event via a sendEvent method. This event is bubbled so that the event can be handled by a listener of the MainDisplay component. This code looks like,</p>
<pre lang="mxml">
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
	xmlns:view="org.puremvc.as3.demos.flex.slacker.view.components.*">

    <mx:Script>
        <![CDATA[
            public static const SPLASH:Number = 0;
            public static const GALLERY:Number = 1;
            public static const EDITOR:Number = 2;
            public static const PROFILE:Number = 3;

            public static const GALLERY_CREATED:String = 'galleryCreated';
            public static const EDITOR_CREATED:String = 'editorCreated';
            public static const PROFILE_CREATED:String = 'profileCreated';

            [Bindable] public var currentViewSelector:Number = SPLASH;
            public var activeView:Object;

            private function sendEvent( action:String ):void
            {
            	dispatchEvent(new Event( action, true ));
            }
        ]]&gt;
    </mx:Script>

    <mx:Binding source="myStack.selectedChild" destination="activeView"/>

    <mx:ViewStack id="myStack" selectedIndex="{currentViewSelector}"
    	creationPolicy="auto"  width="100%" height="100%">
       <view:SplashView />
       <view:GalleryView creationComplete="sendEvent(GALLERY_CREATED)"/>
       <view:EditorView creationComplete="sendEvent(EDITOR_CREATED)"/>
       <view:ProfileView creationComplete="sendEvent(PROFILE_CREATED)"/>
    </mx:ViewStack>

</mx:VBox>
</pre>
<p>The MainDisplayMediator listens for this event and registers a mediator when the child view is created. Checks are performed to ensure that the mediator registration happens only once. The MainDisplayMediator also changes the selected mediator in the ViewStack using typical PureMVC listNotificationInterests and handleNotification methods. The code for the MainDisplayMediator is,</p>
<pre lang="actionscript3">
package org.puremvc.as3.demos.flex.slacker.view
{
    import flash.events.Event;

    import org.puremvc.as3.demos.flex.slacker.ApplicationFacade;
    import org.puremvc.as3.demos.flex.slacker.view.components.MainDisplay;
    import org.puremvc.as3.interfaces.INotification;
    import org.puremvc.as3.patterns.mediator.Mediator;

    public class MainDisplayMediator extends Mediator
    {
        public static const NAME:String = 'MainDisplayMediator';

        public function MainDisplayMediator( viewComponent:Object )
        {
            super( NAME, viewComponent );
        }

        override public function onRegister():void
        {
            mainDisplay.addEventListener( MainDisplay.GALLERY_CREATED, onGalleryCreated );
            mainDisplay.addEventListener( MainDisplay.EDITOR_CREATED, onEditorCreated  );
            mainDisplay.addEventListener( MainDisplay.PROFILE_CREATED, onProfileCreated );
        }

		override public function listNotificationInterests():Array
		{
			return [ApplicationFacade.EDITOR_MODE,
					ApplicationFacade.GALLERY_MODE,
					ApplicationFacade.PROFILE_MODE]
		}

       	override public function handleNotification(note:INotification):void
       	{
       		switch (note.getName())
       		{
       			case ApplicationFacade.EDITOR_MODE:
       				mainDisplay.currentViewSelector = MainDisplay.EDITOR;
       				break;
				case ApplicationFacade.GALLERY_MODE:
       				mainDisplay.currentViewSelector = MainDisplay.GALLERY
       				break;
				case ApplicationFacade.PROFILE_MODE:
       				mainDisplay.currentViewSelector = MainDisplay.PROFILE;
       				break;
       		}
       	}

        protected function onEditorCreated( event:Event ):void
        {
			checkForMediator( MainDisplay.EDITOR, mainDisplay.activeView );
        }

        protected function onGalleryCreated( event:Event ):void
        {
			checkForMediator( MainDisplay.GALLERY, mainDisplay.activeView );
        }

        protected function onProfileCreated( event:Event ):void
        {
			checkForMediator( MainDisplay.PROFILE, mainDisplay.activeView );
        }

        protected function checkForMediator( childSelector:Number, child:Object ):void
        {
            switch (childSelector)
            {
				 case MainDisplay.PROFILE:
				      if ( ! facade.hasMediator( ProfileViewMediator.NAME ) )
				         facade.registerMediator(new ProfileViewMediator( child ));
				      break;
				 case MainDisplay.GALLERY:
				      if ( ! facade.hasMediator( GalleryViewMediator.NAME ) )
				         facade.registerMediator(new GalleryViewMediator( child ));
				      break;
				 case MainDisplay.EDITOR:
				      if ( ! facade.hasMediator( EditorViewMediator.NAME ) )
				         facade.registerMediator(new EditorViewMediator( child ));
				      break;
              }
        }

        protected function get mainDisplay():MainDisplay
        {
            return viewComponent as MainDisplay;
        }

    }
}
</pre>
<h3>After Using Fabrication</h3>
<p>The above code is significantly reduced with Fabrication while preserving the same functionality. With the 0.4 release Fabrication now supports Reflexive Mediator registration. This feature allows you to register a mediator with a component that was created with deferred instantiation without the overhead.</p>
<p>In the MainDisplay we only need to give id&#8217;s to the child view components of the ViewStack. This allows us to identify the components once they are instantiated. Further you no longer need the custom event dispatch. The MainDisplay is now reduced to,</p>
<pre lang="mxml">
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
	xmlns:view="org.puremvc.as3.demos.flex.slacker.view.components.*">

    <mx:Script>
        <![CDATA[
            public static const SPLASH:Number = 0;
            public static const GALLERY:Number = 1;
            public static const EDITOR:Number = 2;
            public static const PROFILE:Number = 3;

            [Bindable] public var currentViewSelector:Number = SPLASH;
            public var activeView:Object;

        ]]&gt;
    </mx:Script>

    <mx:Binding source="myStack.selectedChild" destination="activeView"/>

    <mx:ViewStack id="myStack" selectedIndex="{currentViewSelector}"
    	creationPolicy="auto"  width="100%" height="100%">
       <view:SplashView id="splashView" />
       <view:GalleryView id="galleryView" />
       <view:EditorView id="editorView" />
       <view:ProfileView id="profileView" />
    </mx:ViewStack>

</mx:VBox>
</pre>
<p>The MainDisplayMediator shows even greater impact. Using Reflexive Mediator Registration we can access the child profileView/galleryView/editorView with the descendant operator(..) like, resolve(mainDisplay)..childComponent. And using Fabrication 0.4&#8217;s support for Reflexive Notification Interests, we can indicate interest in a notification and listen to it, all in one step. The code for the MainDisplayMediator is now reduced to,</p>
<pre lang="actionscript3">
package org.puremvc.as3.demos.flex.slacker.view {
	import org.puremvc.as3.demos.flex.slacker.view.components.MainDisplay;
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.utilities.fabrication.patterns.mediator.FlexMediator;

	public class MainDisplayMediator extends FlexMediator {
		public static const NAME:String = 'MainDisplayMediator';

		public function MainDisplayMediator( viewComponent:Object ) {
			super(NAME, viewComponent);
		}

		override public function onRegister():void {
			registerMediator(new ProfileViewMediator(resolve(mainDisplay)..profileView));
			registerMediator(new GalleryViewMediator(resolve(mainDisplay)..galleryView));
			registerMediator(new EditorViewMediator(resolve(mainDisplay)..editorView));
		}

		public function respondToEditorMode(note:INotification):void {
			mainDisplay.currentViewSelector = MainDisplay.EDITOR;
		}

		public function respondToGalleryMode(note:INotification):void {
			mainDisplay.currentViewSelector = MainDisplay.GALLERY;
		}

		public function respondToProfileMode(note:INotification):void {
			mainDisplay.currentViewSelector = MainDisplay.PROFILE;
		}

		protected function get mainDisplay():MainDisplay {
			return viewComponent as MainDisplay;
		}
	}
}
</pre>
<p>This examples illustrated the benefits of using Reflexive Mediator Registration and Reflexive Notification Interests to reduce code complexity. I have added it to the SVN of the Fabrication Google Code project. You can check it out <a href="http://fabrication.googlecode.com/svn/examples/slacker/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codedrunks.com/?feed=rss2&amp;p=112</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
