<?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>GridLinked to RUX &#187; Talks</title>
	<atom:link href="http://www.gridlinked.info/Flex/talks_podcasts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gridlinked.info</link>
	<description>Patterns with Flex, RUX, and software</description>
	<lastBuildDate>Sun, 29 Aug 2010 17:03:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flex Behavior Injection</title>
		<link>http://www.gridlinked.info/flex-behavior-injection/</link>
		<comments>http://www.gridlinked.info/flex-behavior-injection/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 23:29:52 +0000</pubDate>
		<dc:creator>thomasb</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Talks]]></category>
		<category><![CDATA[behavior]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[flexCamp]]></category>
		<category><![CDATA[interactions]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[zoom]]></category>

		<guid isPermaLink="false">http://gridlinked.info/wordpress/?p=20</guid>
        
		                <description><![CDATA[The "Flex Behavior Injection" approach to component development and architectures will change your perspective on Flex software development.]]></description>
				                    <content:encoded><![CDATA[<p><strong><em>This approach</em></strong> to component development and architectures will change your perspective on Flex software development! Consider the myriad situations when you want to add sophisticated functionality like <span style="color: #0070C0;">zoom</span>, <span style="color: #0070C0; ">drag-n-drop</span>, <span style="color: #0070C0; ">swapping</span>, <span style="color: #0070C0;">MDI window minimizing</span>, etc. Instead of designing subclasses or building complex compositions of nested components, developers can create distinct <span style="color: #800000">behavior components</span>. These behavior components are then dynamically attached to target components and <span style="color: #800000;">inject functionality</span>.</p>
<p>I must admit that this software concept is not new. Consider the very popular <a href="http://docs.jquery.com/UI/Resizable" target="_blank"><span style="text-decoration: underline;">JQuery UI Interactions</span></a>. The JQuery UI Resizable code provides functionality to allow 1 or more HTML components to be dynamically resized. Other functionality exists for dragging, dropping, selecting, etc.</p>
<div id="pullquote-con">Using Flex technologies, can we have this same sort of functionality where behaviors are <span style="color: #800000">injected or attached</span> to target components upon demand ?</div>
<p>During Jan &#8216;09 &#8211; at FlexCamp OC in Irvine, CA &#8211; I presented a new topic called <a href="http://www.flexcampoc.com/" target="_blank"><span style="text-decoration: underline;">Flex Behavior Injection</span></a>.  Below is an improved version of the slide deck that I presented at that conference. These slides are interactive; simply click to go to the next or previous slide. You can also zoom the slides using the slide control bar&#8230;</p>
<p><center><br />
<object width="425" height="348"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=flexbehaviourinjection-090303105114-phpapp02"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=flexbehaviourinjection-090303105114-phpapp02"  type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="348"></embed></object><br />
</center></p>
<p>Of course, what good is a slide deck without a live application and code samples? Below is a live version of a well-known Adobe application that demonstrates a charting dashboard solution with multi-chart interactions. Selecting a data point on a chart triggers filters and auto-updates dependent charts. With two (2) lines of code, I have enhanced that application to use injected behaviors for <span style="color: #0070C0;">swapping</span> and <span style="color: #0070C0; ">zooming</span>. Click the picture below to play with the live Flex application. </p>
<p>Here are some helpful tips: To zoom, use the toolbar to select which chart you want to zoom, then click the Zoom button.<br/><br />
To swap a chart:</p>
<ol>
<li>Select the &#8216;Enable Swap&#8217; checkbox,</li>
<li>Then move your mouse over the bottom area of any of the chart panels,</li>
<li>The cursor will change to a hand-cursor,</li>
<li>Click and drag a chart to see how dynamic swapping works</li>
</ol>
<div id="pullquote-con">Snap-to, animation, dragging, <span style="color: #800000">real-time swapping</span>, and constraints are all handled by the Swapper behavior! You can drag a chart, drop anywhere, and the current chart will <span style="color: #800000">snap</span> into place&#8230;</div>
<p>As you drag a chart around, watch how the other charts will swap positions dynamically, on-the-fly as you drag. Even better, with view states, your chart could be coded to change reconfig its states after resizing&#8230; so swapping could also change the layouts of each chart. For example, if placed in an narrow vertical area, the panel could change state to display a datagrid instead of a chart&#8230; you can imagine the sensation and rich user experience that you could offer to users.</p>
<div class="img aligncenter" style="width:403px;">
	<a style="color: #ffffff;" rel="lightbox" href="http://www.gridlinked.info/flash/dashboard4/dashboard4.html"><img src="/flash/dashboard4/dashboard4_proxy.jpg" alt="Chart Dashboard with Behaviors" width="403" height="309" /></a>
	<div>Figure 1: Chart Dashboard with Behaviors (click to launch)</div>
</div>
<p>Below is the main code for the sample application. Notice the Zoomer component tag that is highlighted on line 14. When activated (click event on line 26), the Zoomer handles all nesting and constraint issues for the target component when it zooms. And &#8211; best of all &#8211; the Zoomer handles details of un-zooming the component back to its original settings/location. You can easily imagine the enormous pain of trying to manually cache and restore settings and anchors&#8230;<br />
<br/></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application xmlns<span style="color: #000000; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
		<span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span> <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _target <span style="color: #000000; font-weight: bold;">:</span> UIComponent = <span style="color: #0033ff; font-weight: bold;">null</span>;
        <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">&lt;!--</span> RPC Dataservice component <span style="color: #0033ff; font-weight: bold;">for</span> the chart <span style="color: #004993;">XML</span> <span style="color: #004993;">data</span> <span style="color: #000000; font-weight: bold;">--&gt;</span> 
   <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>HTTPService id=<span style="color: #990000;">&quot;srv&quot;</span> <span style="color: #004993;">url</span>=<span style="color: #990000;">&quot;/data/dashboard4.xml&quot;</span> useProxy=<span style="color: #990000;">&quot;false&quot;</span> result=<span style="color: #990000;">&quot;resultHandler(event)&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">&lt;!--</span> Behavior components <span style="color: #000000; font-weight: bold;">--&gt;</span>
<span style="display:block;background-color: #ffc;">    <span style="color: #000000; font-weight: bold;">&lt;</span>behaviour<span style="color: #000000; font-weight: bold;">:</span>Zoomer	id=<span style="color: #990000;">&quot;zoomer&quot;</span> <span style="color: #004993;">target</span>=<span style="color: #990000;">&quot;{_target}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>   <span style="color: #000000; font-weight: bold;">&lt;</span>swap<span style="color: #000000; font-weight: bold;">:</span>Swapper 	id=<span style="color: #990000;">&quot;swapper&quot;</span> 
			allowedDrops=<span style="color: #990000;">&quot;{[allRegions,regionBreakdown,regionDetail]}&quot;</span> 
			<span style="color: #004993;">active</span>=<span style="color: #990000;">&quot;{_canSwap}&quot;</span> 	<span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>ApplicationControlBar <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Label <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Chart to Zoom:&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>RadioButton label=<span style="color: #990000;">&quot;All Regions&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;_target = allRegions;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>RadioButton label=<span style="color: #990000;">&quot;Breakdown&quot;</span>   <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;_target = regionBreakdown;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>RadioButton label=<span style="color: #990000;">&quot;Details&quot;</span>     <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;_target = regionDetail;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;{zoomer.isZoomed ? 'UnZoom' : 'Zoom'}&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;zoomer.play();&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>            
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Spacer <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>		
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>CheckBox label=<span style="color: #990000;">&quot;Swap Enabled&quot;</span> selected=<span style="color: #990000;">&quot;false&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;_canSwap = (event.target as CheckBox).selected;&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>ApplicationControlBar<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Canvas id=<span style="color: #990000;">&quot;content&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;50&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;10&quot;</span> label=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;10&quot;</span> horizontalScrollPolicy=<span style="color: #990000;">&quot;off&quot;</span> verticalScrollPolicy=<span style="color: #990000;">&quot;off&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;</span>views<span style="color: #000000; font-weight: bold;">:</span>AllRegions   id=<span style="color: #990000;">&quot;allRegions&quot;</span>	
	    		 <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;{content.width/2 - 10}&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span>  <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;0&quot;</span>
	    		 revenueData=<span style="color: #990000;">&quot;{slicedMonthData.source}&quot;</span> 
			 monthChange=<span style="color: #990000;">&quot;monthChange()&quot;</span>   	<span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">&lt;</span>views<span style="color: #000000; font-weight: bold;">:</span>RegionBreakdown id=<span style="color: #990000;">&quot;regionBreakdown&quot;</span> 
			<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;{content.width/2}&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;{content.height/2 - 10}&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;0&quot;</span> 
			regionChange=<span style="color: #990000;">&quot;regionChange()&quot;</span>   <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">&lt;</span>views<span style="color: #000000; font-weight: bold;">:</span>RegionDetail id=<span style="color: #990000;">&quot;regionDetail&quot;</span> 	 
			<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;{content.width/2}&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;0&quot;</span>   <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;{content.height/2 - 10}&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;0&quot;</span> 
			revenueData=<span style="color: #990000;">&quot;{slicedRegionData.source}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Canvas<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>This concept is very powerful. Your view components are not required to know about zooming or swapping (etc.) nor are you &#8211; the developer &#8211; required to configure special view hierarchies or plan for other considerations. Your coding style remains unchanged and your framework(s) [e.g. Cairngorm, CGX, Mate, etc.] remains unchanged.</p>
<p>Many people have asked for the source code to these components. This code will be open-sourced soon and the release is planned within the near future. Please consider rating this blog post and submitting some comments. You may subscribe to my blog RSS for auto-notifications when the <span style="color: #800000">Flex Behavior library</span> is released. <img src='http://www.gridlinked.info/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
<br/></p>
<hr />
<p><small>© Thomas Burleson for <a href="http://www.gridlinked.info">GridLinked to RUX</a>, 2009.   
&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;  
<a href="http://feedburner.google.com/fb/a/mailverify?uri=GridlinkedToRux&amp;loc=en_US"><span style="color:#900">Subscribe by Email</span></a> |
<a href="mailto:ThomasBurleson@GMail.com">Contact Author</a> 	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;
<a href="http://www.gridlinked.info/flex-behavior-injection/">Permalink</a> |    
<a href="http://www.gridlinked.info/flex-behavior-injection/#comments">5 comments</a>
<br/>
</small></p>]]></content:encoded>
                        
		<wfw:commentRss>http://www.gridlinked.info/flex-behavior-injection/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
