<?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>Thinking in Code &#187; Flex</title>
	<atom:link href="http://www.michelboudreau.com/category./flash/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.michelboudreau.com</link>
	<description>Michel Boudreau&#039;s Personal Blog</description>
	<lastBuildDate>Wed, 25 Apr 2012 20:18:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Actionscript Label Statements for Loops</title>
		<link>http://www.michelboudreau.com/2011/08/28/actionscript-label-statements-for-loops/</link>
		<comments>http://www.michelboudreau.com/2011/08/28/actionscript-label-statements-for-loops/#comments</comments>
		<pubDate>Sun, 28 Aug 2011 07:04:59 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[break]]></category>
		<category><![CDATA[label]]></category>
		<category><![CDATA[loops]]></category>
		<category><![CDATA[statement]]></category>

		<guid isPermaLink="false">http://www.michelboudreau.com/?p=747</guid>
		<description><![CDATA[I have to say that I&#8217;m ashamed that I didn&#8217;t ...]]></description>
			<content:encoded><![CDATA[<p>I have to say that I&#8217;m ashamed that I didn&#8217;t know about this beforehand. I&#8217;ve recently discovered a little feature in Actionscript called <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/statements.html#label">label statements</a>. &nbsp;I always expect to learn new things in the industry since it&#8217;s every-changing, however I did not think I would learn something new about Actionscript since I&#8217;ve used it since AS1 and have thoroughly studied AS3 when it came out.<br />
<span id="more-747"></span></p>
<p>Let&#8217;s give a quick example of a simple problem: You need to find the index of a string within a 2D array and do something with that index. &nbsp;Here&#8217;s how I would do it normally:</p>
<pre class="brush: as3; title: ; notranslate">
private function findIndex(text:String):void
{
	var row:Array;
	var index:Point;
	for(var y:uint = 0, ylen:uint = array.length; y&lt;ylen; y++)
	{
		row = array[y];
		for(var x:uint = 0, xlen:uint = row.length; x&lt;xlen; x++)
		{
			if(row[x] == text)
			{
				index = new Point(x,y);
				break;
			}
		}
		if(index)
		{
			break;
		}
	}
	// Do something with index
}
</pre>
<p>You&#8217;ll notice that within the example, the second I find the index, I break out of the loops to reduce the run time of the function.  The external loop always looks to see if &#8216;index&#8217; is not null and breaks out if it is.  I&#8217;ve never liked this approach because it adds more code than needed and sometimes its not as easy as just checking if a variable is not null.  You could always use &#8216;return&#8217; if your function is done with its purpose, but that&#8217;s not always possible.</p>
<p>The alternative to this is using label statements.  What you can do is simply &#8216;label&#8217; your loops and then when you want to break, you can specify which loop that needs to be broken.  Take our current example and let&#8217;s add label statements in it:</p>
<pre class="brush: as3; title: ; notranslate">
private function findIndex(text:String):void
{
	var row:Array;
	var index:Point;
	outer:for(var y:uint = 0, ylen:uint = array.length; y&lt;ylen; y++)
	{
		row = array[y];
		for(var x:uint = 0, xlen:uint = row.length; x&lt;xlen; x++)
		{
			if(row[x] == text)
			{
				index = new Point(x,y);
				break outer;
			}
		}
	}
	// Do something with index
}
</pre>
<p>That is much better and cleaner.  I&#8217;ve seen this done before in Java, but I have never encountered or read about it for Actionscript.  This method can also be used with the &#8216;continue&#8217; operator so that it skips the rest of the code to the next iteration or with block statements like so:</p>
<pre class="brush: as3; title: ; notranslate">
doSomething: {
	var x:uint = index.x;
	if(x &gt; 100)
	{
		break doSomething;
	}
	trace(x);
}
</pre>
<p>I don&#8217;t think I would ever use it with block statements since these could be simply replaced with &#8216;if&#8217; statements, but knowing about it can be beneficial.  I know I will be using label statements in nested loops from now on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2011/08/28/actionscript-label-statements-for-loops/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Presenter vs. Mediator</title>
		<link>http://www.michelboudreau.com/2011/05/19/presenter-vs-mediator/</link>
		<comments>http://www.michelboudreau.com/2011/05/19/presenter-vs-mediator/#comments</comments>
		<pubDate>Thu, 19 May 2011 21:48:15 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[Jens Halm]]></category>
		<category><![CDATA[lab49]]></category>
		<category><![CDATA[mediator]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[parsley]]></category>
		<category><![CDATA[presenter]]></category>
		<category><![CDATA[robotlegs]]></category>

		<guid isPermaLink="false">http://www.michelboudreau.com/?p=693</guid>
		<description><![CDATA[This discussion has raged on for some time. Both are ...]]></description>
			<content:encoded><![CDATA[<p>This discussion has raged on for  some time.  Both are fairly common patterns used for front-end development; it&#8217;s a new take on the classic MVC pattern.  Recently, the argument has been re-ignited by the choice between two great application frameworks for Flex: <a href="http://www.robotlegs.org/" target="_blank">RobotLegs</a> and <a href="http://www.spicefactory.org/parsley/" target="_blank">Parsley</a>.</p>
<p><span id="more-693"></span></p>
<p>I will say this right away, I&#8217;m biased towards Parsley and have advocated its use for over a year and a half now.  It has time and time again proven itself a reliable, robust and rapid framework for application development.  Its track record is quite impressive;  It was used to build some of the world&#8217;s largest Flex applications.  Jens Halm, the creator of Parsley, has done a wonderful job at making his framework extensible, fast and optimized for both Flash and Flex.  Robotlegs is also a good framework, don&#8217;t get me wrong, it just doesn&#8217;t capture me as much and it&#8217;s not optimized for Flex (pure Actionscript), but  in the end it comes down to your development preference.</p>
<p>Now to ask the question, which pattern we use for our project? <a href="http://en.wikipedia.org/wiki/Model-view-presenter" target="_blank">Presenter</a> or <a href="http://en.wikipedia.org/wiki/Mediator_pattern" target="_blank">Mediator</a>?  Parsley is built around the Presenter pattern while RobotLegs uses Mediator.  Simply speaking, the difference between the two is fairly minimal, but can affect your project quite a bit.  Here&#8217;s a quick diagram on how they work:</p>
<p><a href="http://www.michelboudreau.com/wp-content/uploads/2011/05/StandardsDesignPatterns.png"><img class="aligncenter size-full wp-image-733" title="Standards&amp;DesignPatterns" src="http://www.michelboudreau.com/wp-content/uploads/2011/05/StandardsDesignPatterns.png" alt="" width="455" height="325" /></a></p>
<p>If you remember your UML class diagrams, you would see that a Mediator can only have one View, while the View can have many Mediators.  In this case, the Mediator is the &#8216;man-in-the-middle&#8217; since nobody else knows about it; its sole purpose is to listen to the View and give it data.  The View communicates with the Mediator through events to which the Mediator acts upon.  One thing I like about this pattern is that it forces developers to use a proper &#8220;data in, events out&#8221; methodology and separates the concerns of the business from the View.  This also creates decoupled components since there&#8217;s no hard dependency in the View; it could still fully function if it is moved into another project.</p>
<p>For the Presenter, things are a bit different since the View knows about it.  The Presenter is there to just present data which is easily binded within the View, but this is problematic since it&#8217;s coupling your View to that Presenter and even the model (data).  However, you don&#8217;t need to use events within the View to communicate to your Presenter since you can access its public functions directly.  It&#8217;s easier to use this method because it limits the code needed to communicate between the View and the Presenter, but it&#8217;s coupling your View.</p>
<p>In the diagram, you might have noticed that with a Mediator pattern you can have a View with several Mediators and even reuse the Mediators on other Views.  This makes the <em>Mediator more of a View based pattern</em>.  The Presenter however doesn&#8217;t care and a View can have multiple Presenters which can (and should) be reused across multiple Views to display the data they need.  This makes the <em>Presenter more of a data based pattern</em> since it&#8217;s job is to give access to data and manage it.</p>
<p>There you have it.  One thing to remember is that patterns are meant to help you develop, not make it harder.   Since I love Parsley so much and had a need for a Mediator pattern for a project (needed to decouple the component) and Parsley only provides a Presenter pattern, I extended the framework to include a Mediator tag. <a href="https://github.com/mboudreau/Parsley-Mediator" target="_blank"> It&#8217;s completely open source and now on GitHub</a>.  Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2011/05/19/presenter-vs-mediator/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New York Flex Meetup Videos</title>
		<link>http://www.michelboudreau.com/2011/05/10/new-york-flex-meetup-videos/</link>
		<comments>http://www.michelboudreau.com/2011/05/10/new-york-flex-meetup-videos/#comments</comments>
		<pubDate>Wed, 11 May 2011 03:18:15 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mike's Flex Channel]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[franck wolff]]></category>
		<category><![CDATA[graniteds]]></category>
		<category><![CDATA[lab49]]></category>
		<category><![CDATA[New York Flex Meetup]]></category>
		<category><![CDATA[paul taylor]]></category>
		<category><![CDATA[tinytlf]]></category>
		<category><![CDATA[tlf]]></category>
		<category><![CDATA[videos]]></category>

		<guid isPermaLink="false">http://www.michelboudreau.com/?p=720</guid>
		<description><![CDATA[Last night we had another meetup at the Lab49 hideout. ...]]></description>
			<content:encoded><![CDATA[<p>Last night we had another meetup at the Lab49 hideout.  This time around, we had my co-worker and friend <a href="http://guyinthechair.com/" target="_blank">Paul Taylor</a> present on Adobe&#8217;s RTE &amp; TLF engine as well as his alternative project, <a href="http://www.guyinthechair.com/tag/tinytlf/" target="_blank">TinyTLF</a>. As an added bonus, we had the founder of <a href="http://www.graniteds.org/" target="_blank">GraniteDS</a>, Franck Wolff, come talk to us about what Granite can do for us and our project.</p>
<p>Videos for both presentations are available after the break.</p>
<p><span id="more-720"></span></p>
<div class="oembed oembed-video oembed-ustream-tv oembed-video-ustream-tv"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="296" id="utv203359" name="utv_n_853206"><param name="flashvars" value="loc=%2F&amp;autoplay=false&amp;vid=14597709&amp;locale=en_US" /><param name="wmode" value="opaque" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.ustream.tv/flash/viewer.swf" /><embed flashvars="loc=%2F&amp;autoplay=false&amp;vid=14597709&amp;locale=en_US" width="480" height="296" wmode="opaque" allowfullscreen="true" allowscriptaccess="always" id="utv203359" name="utv_n_853206" src="http://www.ustream.tv/flash/viewer.swf" type="application/x-shockwave-flash" /></object></div>
<div class="oembed oembed-video oembed-ustream-tv oembed-video-ustream-tv"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="296" id="utv503542" name="utv_n_555545"><param name="flashvars" value="loc=%2F&amp;autoplay=false&amp;vid=14598584&amp;locale=en_US" /><param name="wmode" value="opaque" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.ustream.tv/flash/viewer.swf" /><embed flashvars="loc=%2F&amp;autoplay=false&amp;vid=14598584&amp;locale=en_US" width="480" height="296" wmode="opaque" allowfullscreen="true" allowscriptaccess="always" id="utv503542" name="utv_n_555545" src="http://www.ustream.tv/flash/viewer.swf" type="application/x-shockwave-flash" /></object></div>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2011/05/10/new-york-flex-meetup-videos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Spoon!</title>
		<link>http://www.michelboudreau.com/2011/05/10/flex-spoon/</link>
		<comments>http://www.michelboudreau.com/2011/05/10/flex-spoon/#comments</comments>
		<pubDate>Tue, 10 May 2011 21:58:07 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[lab49]]></category>
		<category><![CDATA[Michael Labriola]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[spoon]]></category>

		<guid isPermaLink="false">http://www.michelboudreau.com/?p=711</guid>
		<description><![CDATA[Spoon is a new project created by Flex expert Michael ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.spoon.as/" target="_blank">Spoon</a> is a new project created by Flex expert <a href="http://www.twitter.com/mlabriola" target="_blank">Michael Labriola</a> to create a community driven Flex SDK.  It&#8217;s also a play-on word of GitHub&#8217;s &#8216;<a href="http://help.github.com/fork-a-repo/" target="_blank">fork</a>&#8216; since the project doesn&#8217;t diverge off from the Flex SDK, but instead keeps up with it as well as merge in community created patches and enhancements.</p>
<p>In a way, this project (once it gets started in full force) will be one step ahead of Adobe because of the sheer number of developer resources out there on the web.  Definitely something to keep an eye on, so please sign up and contribute!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2011/05/10/flex-spoon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Post Parsley BYOL Workshop Summary</title>
		<link>http://www.michelboudreau.com/2011/02/08/post-parsley-byol-workshop-summary/</link>
		<comments>http://www.michelboudreau.com/2011/02/08/post-parsley-byol-workshop-summary/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 19:22:36 +0000</pubDate>
		<dc:creator>Michel Boudreau</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mike's Flex Channel]]></category>
		<category><![CDATA[Workshop]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[bring your own laptop]]></category>
		<category><![CDATA[byol]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[lab49]]></category>
		<category><![CDATA[new york]]></category>
		<category><![CDATA[parsley]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ustream]]></category>
		<category><![CDATA[workshop]]></category>

		<guid isPermaLink="false">http://www.michelboudreau.com/?p=678</guid>
		<description><![CDATA[Last night I held a Parsley Bring Your Own Laptop ...]]></description>
			<content:encoded><![CDATA[<p>Last night I held a Parsley Bring Your Own Laptop Workshop, part of the <a href="http://www.meetup.com/New-York-Flex-Meetup/" target="_blank">New York Flex Meetup</a>.  We had a very good attendance (around 26 people) considering how niche the topic is.  I&#8217;d like to thank everyone for participating to this event and to help us reach 100 members.  It is with your continued involvement that we&#8217;ll reach 200 by year&#8217;s end.</p>
<p><a href="http://www.michelboudreau.com/wp-content/uploads/2011/02/IMG_20110207_183733.jpg"><img class="aligncenter size-medium wp-image-680" title="IMG_20110207_183733" src="http://www.michelboudreau.com/wp-content/uploads/2011/02/IMG_20110207_183733-300x224.jpg" alt="" width="300" height="224" /></a><span id="more-678"></span></p>
<p>As usual, we&#8217;ve recorded the workshop on UStream.  You can follow along using the <a href="http://www.michelboudreau.com/wp-content/uploads/2011/02/ParsleyWorkshop.zip">pre-made workshop files</a> or you can skip right to the end and get the <a href="http://www.michelboudreau.com/wp-content/uploads/2011/02/ParsleyWorkshop-Full.zip">completed workshop files</a>.  I hope that this helps anyone out there trying to learn Parsley for their next project.</p>
<p>I&#8217;d also like to thank <a href="http://www.lab49.com" target="_blank">Lab49</a> for their continued sponsorship of the New York Flex Meetup and events such as these.  As well as <a href="http://www.adobe.com" target="_blank">Adobe </a>for providing 2 Flash Builder 4 Premium licenses and <a href="http://shanky.org/" target="_blank">Shashank Tawari</a> for giving 3 <a href="http://www.amazon.com/AdvancED-Flex-4-Shashank-Tiwari/dp/1430224835/ref=sr_1_1?ie=UTF8&amp;qid=1297193254&amp;sr=8-1" target="_blank">AdvancED Flex 4</a> books to give away at the event.</p>
<div class="oembed oembed-video oembed-ustream-tv oembed-video-ustream-tv"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="296" id="utv274940" name="utv_n_69740"><param name="flashvars" value="loc=%2F&amp;autoplay=false&amp;vid=12537357&amp;locale=en_US" /><param name="wmode" value="opaque" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.ustream.tv/flash/viewer.swf" /><embed flashvars="loc=%2F&amp;autoplay=false&amp;vid=12537357&amp;locale=en_US" width="480" height="296" wmode="opaque" allowfullscreen="true" allowscriptaccess="always" id="utv274940" name="utv_n_69740" src="http://www.ustream.tv/flash/viewer.swf" type="application/x-shockwave-flash" /></object></div>
]]></content:encoded>
			<wfw:commentRss>http://www.michelboudreau.com/2011/02/08/post-parsley-byol-workshop-summary/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/9 queries in 0.004 seconds using disk: basic
Object Caching 548/548 objects using disk: basic

Served from: www.michelboudreau.com @ 2012-05-21 06:47:30 -->
