<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Technical Notes</title>
    <link rel="alternate" type="text/html" href="http://www.thomasburleson.biz/" />
    <link rel="self" type="application/atom+xml" href="http://www.thomasburleson.biz/atom.xml" />
   <id>tag:www.thomasburleson.biz,2007://3</id>
    <link rel="service.post" type="application/atom+xml" href="http://thomasburleson.biz/blog-mt/mt-atom.cgi/weblog/blog_id=3" title="Technical Notes" />
    <updated>2007-07-08T17:00:21Z</updated>
    <subtitle><![CDATA[Using Flex, ColdFusion, Java, &amp; Groovy  technologies to deliver commercial RIAs.]]></subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.2ysb5-20051201</generator>
 
<entry>
    <title>Cairngorm View Notifications</title>
    <link rel="alternate" type="text/html" href="http://www.thomasburleson.biz/2007/06/cairngorm_view_notifications.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://thomasburleson.biz/blog-mt/mt-atom.cgi/weblog/blog_id=3/entry_id=8" title="Cairngorm View Notifications" />
    <id>tag:www.thomasburleson.biz,2007://3.8</id>
    
    <published>2007-06-08T16:26:51Z</published>
    <updated>2007-07-08T17:00:21Z</updated>
    
    <summary>. Cairngorm, however, is not ready for 100% &quot;out-of-the-box&quot; implementations of production applications.  The current versions of Caingorm (version 2.2 or before) need to be &quot;tweaked&quot; for production use. One of those areas encompasses the subject of &quot;view notifications&quot;.</summary>
    <author>
        <name>Thomas Burleson</name>
        <uri>www.UniversalMind.com</uri>
    </author>
            <category term="Cairngorm" />
            <category term="Flex" />
    
    <content type="html" xml:lang="en" xml:base="http://www.thomasburleson.biz/">
        <![CDATA[As Flex continues to grow as the choice RIA technology, many developers start investigating and apply JEE patterns to Flex implementations. Cairngorm is a Model-View-Controller framework - endorsed by Adobe - that is widely popular within the community. Cairngorm, however, is not ready for 100% &quot;out-of-the-box&quot; implementations of production applications.&nbsp; The current versions of Caingorm (version 2.2 or before) need to be &quot;tweaked&quot; for production use. One of those areas encompasses the subject of &quot;view notifications&quot;.]]>
        <![CDATA[<p>A recent blog article entry by <a target="_blank" href="As Flex continues to grow as the choice RIA technology, many developers start investigating and apply JEE patterns to Flex implementations. Cairngorm is a Model-View-Controller framework - endorsed by Adobe - that is widely popular within the community. Cairngorm, however, is not ready for 100% &quot;out-of-the-box&quot; implementations of production applications.  The current versions of Caingorm (version 2.2 or before) need to be &quot;tweaked&quot; for production use. One of those areas encompasses the subject of &quot;view notifications&quot;. A recent blog article entry by Derrick Grigg articulates this very well; see  http://www.dgrigg.com/post.cfm/04/12/2007/Cairngorm-Commands-Views-and-Harikiri. Derrick discusses an issue that every cairngorm developer encounters at some point. ">Derrick Grigg</a> articulates this very well; in the blog entry Derrick discusses an issue that every cairngorm developer encounters at some point. <br /><br />The basic premise of the Cairngorm Model-View-Controller framework is:<br /><br /></p><ol><li>Model is a global repository for data</li><li>Views use databinding to &quot;watch&quot; Model data changes and show formatted data. <br />Views allow user interactions and dispatch user gestures as events</li><li>Controller forwards events to commands for processing<br />Commands update model data </li><li>.... back to (1).</li></ol><p><br />Consider the Cairngorm approach where a Command instance employs a Delegate class as &quot;proxy&quot; to the remote data services. The command instance &quot;submits&quot; itself as a responder to the delegate. The delegate, in turn, simply uses the specified responder [via the async token] to allow data service responses to go directly to event handlers within the command. </p><p>But how can the view be directly notified of the data service response and status? In the &quot;real world&quot; databinding solutions espoused by Adobe is not always sufficient... <br /><br />However, the solution proposed in that blog requires several compensations: <br /><br /></p><ol><li>Views must employ/register private view controllers with the front controller,</li><li>Command must dispatch new &quot;notify view&quot; events thru the front Controller to the view controller</li></ol><p><br />This solution creates a proliferation of view controllers and is useful ONLY when multiple views want to listen to the same event and be notified simultaneously. A custom event bridge or a traditional databinding approach would be more practical for such situations [but that is another article]. In fact, in most scenarios, the view simply wants the notification directly and singularly.<br /><br />As a result, ViewControllers are not the solution! There is a simpler - and better - solution to the issue; a solution that we have used successfully on many Universal Mind projects.<br /><br />!! Use callbacks to serve as proxy responders for a view's cairngorm events !! <br /><br /><u>Question</u>: &quot;Can you say that in English?&quot;<br /><u>Answer</u>:&nbsp;&nbsp;&nbsp; Allow the view to submit itself as a responder to the event processor [e.g. command]. </p><p>This solution is consistent with the approach used by the command where the command, in turn, submits itself as a responder to the delegate. The view attaches itself (via a proxy) as part of a queued chain of responders to the actual dataservices request/response.<br /><br />How is this &quot;chaining&quot; of responders easily done? Well, when we dispatch events to commands, we create custom events. So we simply need to package a responder along with the normal event information that is dispatched to the Cairngorm framework.&nbsp; If all custom events have a constructor attribute to allow transporting the responder also... <br /><br />The command instance can temporarily cache the view responder/callback. Sometime later - after the asynchronous data service call responds, the following can happen:<br /></p><ol><li>the data service responses can be handled by the command to update the ModelLocator directly, trigger databindings to update, and </li><li>the data service responses or OTHER responses can also be forwarded by the command to the responder as to &quot;notify&quot; the view.</li></ol><p><u>Question</u>: &quot;You mean my views all have to support some responder interface or be a subclass of <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; some view parent class?&quot; <br /><u>Answer</u>:&nbsp;&nbsp; &quot;No!&nbsp; Yikes, that would be awful!&quot;<br /><br />Instead of requiring an <em>abomination </em>of view inheritance where all your mxml classes have to extend some base class, the view will instead create an instance of a CallBack class that will serve as a proxy responder class. Much like addEventListener(&lt;event type&gt;, &lt;event handler&gt;,...), the callback uses syntax like &quot;new Callback(&lt;result handler&gt;, ,&lt;fault handler&gt;=null)&quot;. </p><p>Notice how the callback class does NOT know any details of the view itself. It simply has functions that may be called during an event response. And notice that the view does NOT know anything about who handles the event or how the event is processed. This &quot;<u>separation of concerns</u>&quot; is what MVC is all about. Don't forget to include this OPTIONAL callback instance as part of the event that will be dispatched. </p><p>So now let us look at some code. Below we see an example of functionality created to load user details from the server (or in a local cache). We use a custom event 'LoadUserDetailsEvent' class that accepts an optional &quot;responder&quot; parameter.</p><p><br /><br />&nbsp;private function loadUserDetails(user:UserVO):void {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; // notice how we &quot;wrap&quot; our view-level event handlers in a proxy responder instance<br />&nbsp;&nbsp;&nbsp; // here we use something like public class Callbacks implements IResponder { ... }<br />&nbsp;&nbsp;&nbsp; var responder : IResponder= new Responder(onResults_loadUserDetails,onFault_loadUserDetails);<br /><br />&nbsp;&nbsp;&nbsp; // Now simply dispatch [via controller] to the specific-command that is registered to &quot;handle&quot; this event<br />&nbsp;&nbsp;&nbsp; CairngormEventDispatcher.dispatchEvent( new LoadUserDetailsEvent(user,responder) );<br />&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp; private function onResults_loadUserDetails(info:Object):void {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // This is the &quot;responder&quot;-like result handler<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // that is called asynchronously when the command is is notified of the dataservice response<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // or synchronously if the user details were stored in a local in-memory cache<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var details : UserDetailsVO = (info as UserDetailsVO);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ....<br />&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp; &lt;mx:Button click=&quot;loadUserDetails(this.currentUser)&quot; /&gt;</p><p>&nbsp;</p><p>To summarize the above code snippet as psuedo-code, you (a) use a callback proxy wrapper class, (b) package the callback instance inside the event, and (c) extend the command base class to support the caching of the callback/view responder. And voila' you are done! <br /><br />This is VERY clean: <br /></p><ol><li>your views are still standard mxml or as classes with aggregates and composite controls, </li><li>event dispatching is the same [with an optional callback] and </li><li>you do NOT have to create crude view controllers to handle view notifications</li><li>each view instance can have its OWN, separate callback</li><li>views can then support&nbsp; modal operations, undos, reverts, commits, etc... completely independent of each other.</li></ol><p>This solution will soon be presented to the Adobe Cairngorm committee as a candidate for incorporation into the base framework. Additionally, we will be providing this &quot;extension&quot; and others as a open-source extension to cairngorm. If you are interested in this and other extensions please send emails to ThomasB@UniversalMind.com or visit blog.universalmind.com. <br /></p><p>&nbsp;</p>]]>
    </content>
</entry>
<entry>
    <title>Flex Pitfalls</title>
    <link rel="alternate" type="text/html" href="http://www.thomasburleson.biz/2007/01/flex_pitfalls.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://thomasburleson.biz/blog-mt/mt-atom.cgi/weblog/blog_id=3/entry_id=7" title="Flex Pitfalls" />
    <id>tag:www.thomasburleson.biz,2007://3.7</id>
    
    <published>2007-01-27T09:42:44Z</published>
    <updated>2007-07-08T17:00:21Z</updated>
    
    <summary>I am frequently asked to assist development teams with assessing their architectures, implementations, and deployment processes. In fact, whenever I start working with a development team,I have a mental list of issues that I ALWAYs use during the course of performing code reviews and recommendations.</summary>
    <author>
        <name>Thomas Burleson</name>
        <uri>www.UniversalMind.com</uri>
    </author>
            <category term="Flex" />
    
    <content type="html" xml:lang="en" xml:base="http://www.thomasburleson.biz/">
        <![CDATA[<p>I am frequently asked to assist development teams with assessing their architectures, implementations, and deployment processes. In fact, whenever I start working with a development team,I have a mental list of issues that I ALWAYs use during the course of performing code reviews and recommendations.<br /><br />While my &quot;list&quot; may be different for different technologies (Coldfusion, Java, Flex, Flash) and for client-side and server-side development, I thought I would outline most of the issues that I use when I am involved with client-side Flex technologies. </p><p>These issues - enumerated below - issues are categorized as &quot;Pitfalss of Flex&quot;. <br /></p>]]>
        <![CDATA[<br /> - General Issues - <br /> <br /> Are coding standards defined and consistent within the implementations.<br /> - e.g. are &quot;reverse-url&quot; package names used<br /> - e.g. are camel-case (upper and lower) used appropriately<br /> Are naming conventions understandable, maintainable, and consistent<br /> What design patterns are used.<br /> <br /> - Application Issues - <br /> <br /> Are Flash assets (swfs, movieclips) used<br /> How is embedded assets implemented<br /> Are CSS used and consistent<br /> Are Modules used to dynamically load functionality<br /> How are effects utilizied<br /> Are view states &amp; transitions used<br /> Is &lt;mx:Script source=&quot;xxx&quot; /&gt; used<br /> Does the application use custom events for controller interactions <br /> <br /> - Controller Issues - <br /> <br /> Is the code structured in a MVC pattern<br /> Is Cairngorm used or a &quot;home-grown&quot; version<br /> Are dataservices totally hidden for the model &amp; views<br /> Is FDS used (RemoteObject, Publish/Subscribe, DataSynch)<br /> Is E4X used<br /> <br /> <br /> - Model Issues - <br /> <br /> Are value objects used<br /> Are E4X models translated to ValueObjects<br /> Is remote data [marshalling] deserialized as Objects or ValueObjects<br /> Is [Bindable] used appropriately<br /> Is data-sharing mandatory or only as needed<br /> - e.g. views that maintain local data should not store that data in global repositories<br /> <br /> - View Issues - <br /> <br /> Do parent views cascade data to nested views<br /> - e.g. Child views should almost never bind to global data (except for lookups) <br /> Are the views decoupled properly<br /> - e.g. use public properties &amp; custom events for coupling<br /> Are the views &quot;black-boxed&quot;<br /> - sources of incoming data are unknown<br /> - targets for outgoing events are unknown<br /> - logic for specific view is localized<br /> - are MetaData tags used appropriately<br /> - are changeEvents announced properly<br /> - are implicit getters &amp; setters used properly<br /> Does the application use custom events for view interactions <br /> Do the views use custom events <br /> <p><br /> Please note the above issues do not address the development considerations of &quot;change management&quot; (aka version control), build strategies and scripts, automated integration and automated testing, or deployment processes. </p>Nor do these address the more subtle issues of application footprint (download size), load speeds, error handling, inter-session usages, and packaging. <br /> <br /> All together, when a development team addresses these considerations - even in a rudimentary fashion, then the deployed applications can be delivered with high-levels of confidence as applications that are robust, maintainable, extendable, and reusable.<br /> <br /> <br /> <br /> <br /> <br /> <br /> ]]>
    </content>
</entry>
<entry>
    <title>Learning to love Cairngorm!</title>
    <link rel="alternate" type="text/html" href="http://www.thomasburleson.biz/2006/12/learning_to_love_cairngorm.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://thomasburleson.biz/blog-mt/mt-atom.cgi/weblog/blog_id=3/entry_id=3" title="Learning to love Cairngorm!" />
    <id>tag:thomasburleson.biz,2007://3.3</id>
    
    <published>2006-12-30T22:51:06Z</published>
    <updated>2007-07-08T17:00:21Z</updated>
    
    <summary>The issue is not that Cairngorm is wrong... more that the Cairngorm implementation needs to be optimized. </summary>
    <author>
        <name>Thomas Burleson</name>
        <uri>www.UniversalMind.com</uri>
    </author>
            <category term="Cairngorm" />
    
    <content type="html" xml:lang="en" xml:base="http://www.thomasburleson.biz/">
        <![CDATA[<p><a href="http://labs.adobe.com/wiki/index.php/Cairngorm"> Cairngorm</a> is an Adobe-endorsed, industry-standard Model-View-Controller [MVC] framework for the Flex platform. Based on well-known j2EE design patterns, the MVC framework defines an design approach for scalable, enterprise-level software solutions. Cairngorm is not new! <br />                               </p>                               ]]>
        <![CDATA[<br />                                                              <p align="center"><a title="Diagram of MVC Relationships" target="_blank" href="http://www.thomasburleson.biz/images/mvc_full.gif"><img width="330" height="158" border="0" src="http://www.thomasburleson.biz/images/mvc_thumb.gif" /></a><br />                              </p><blockquote><p>                               MVC frameworks are used everywhere.<br /></p></blockquote><ul><li>Java developers use <a href="http://struts.apache.org/">Struts</a>,</li><li>ColdFusion developers use <a href="http://www.mach-ii.com/">mach-ii</a>,</li><li>Flash developers use <a href="http://ariaware.com/products/arp/docs/arp.htm">ARP</a>, and</li><li>Flex developers use <a href="http://labs.adobe.com/wiki/index.php/Cairngorm">Cairngorm</a>.</li></ul>   <p>Not only is MVC framework based on a set of <a href="http://www.gskinner.com/blog/archives/2005/08/on_design_patte.html">architectural heuristic</a> (rule-of-thumb)... it is serves as a best-practice for creating great software. Using MVC helps to avoid those notorious conditions of &quot;spaghetti-code&quot; and component couplings that kill any component reuse. </p> <p>Remember it is not only important for your MVC implementations to be quick-n-easy to use, it is essential for the code to be extremely stable when changes occur. Other developers - new to the project - should also be able to easily maintain and enhance the existing code base. The Cairngorm MVC provides a framework that helps accomplish all these objectives!</p> <p><u><span class="question-title">Question</span></u><span class="style3">:</span><span class="question"> Is Cairngorm only for large Flex projects?</span></p>                               <p>Absolutely <u>not</u>! We have all worked on projects where only one view or screen was initially required; only to discover scope changes that demanded more screens, more business logic, more complexities. Small projects that use the Cairngorm MVC designs can easily scale and allow views to be radically changed or reused in other composite views... without changes to business logic or data access. </p>                               <p>Cairngorm simple defines connections or relationships between the view(s), the model data, and the business logic (controller). Developers only need to remember the following 3 design principles:</p><blockquote><p> Views:<br /></p></blockquote><ul><li>Never know where or how the data is loaded or persisted</li><li>Show data in rich formats</li><li>Allow users to interact with the data &amp; controls</li><li>Use events to announce user interactions or changes to data  </li></ul><blockquote><p>Controllers:<br /></p></blockquote><ul><li>Are used for loading or persisting remote data or</li><li>Are used to <u>coordinate</u> activity between completely separate components within the Flex application</li><li>Never know how a view(s) show the data. To controllers, views are &quot;black boxes&quot; where the internals are unknowns</li></ul> <blockquote>  Models:<br /></blockquote><ul><li>Are simply global areas to store &amp; access data already present in-memory. This data can be structures or objects or both...</li><li>Are containers for business data &amp; settings to allow views to share data &amp; to coordinate state</li></ul>                                <p><span class="style3"><u class="question-title">Question</u>: </span><span class="question">Why do so many developers resist using Cairngorm?</span></p>                               <p>Many developers have implemented their own MVC version. Unfortunately those version present maintenance issues and have not been adopted as an industry standard; Cairngorm is an Flex industry standard and is well known to a wide range of developers and development teams. </p>                               <p>Another common response is that the Cairngorm implementation creates so many classes and files that the application becomes &quot;heavy&quot; and impossible to manage or track. </p>                               <p>Many developers - even architects - do not welcome Cairngorm implementations because they have not <span class="style4"><u>optimized its implementations</u></span> and feel that real-world uses resulted in distorted MVC solutions. </p>                               <p><span class="style3"><u class="question-title">Question</u>:</span> <span class="question">Okay, so what is wrong with Cairngorm?</span></p>                               <p>The issue is not that Cairngorm is wrong... more that the Cairngorm implementation needs to be optimized. &quot;WTF does 'optimized implementation' mean?&quot; To answer this question, allow me to make some bold statements. </p><blockquote><p>                                Deprecated Cairngorm classes<br /></p></blockquote><ul><li>ViewHelpers should NEVER be used</li><li>ViewLocator should NEVER be used   </li></ul><p>&nbsp;</p><blockquote><p>Extensions to Cairngorm (<span class="question">&quot;Optimized Implementations&quot;</span>)<br /></p></blockquote><ul><li>Commands should respond to-/handle multiple events</li><li>View instances need ways to be directly notified of event responses.</li><li>CairngormEvents should bubble... so dispatchEvent() can be used </li></ul><p>&nbsp;</p>  <blockquote>   Best Practices<br /></blockquote><ul><li>Use of the Delegate is optional but recommended</li><li>State should be maintained &amp; localized within views</li><li>View-specific data should be maintained/localized in the view</li><li>Only application-wide data should  be maintained in the Model</li><li>Model.getInstance() should only be referenced by &quot;top&quot; parent views</li><li>Only &quot;global&quot; events should be dispatched to controllers.</li></ul>                                                               <p>Above, I have enumerated the areas in which Cairngorm may be used and improved. In upcoming blog entries, we will review details and see how an optimized Cairngorm [more lightweight &amp; optimized] can be the solution for almost every project... even the small ones!</p>                               <p>With an understanding of the above recommendations, developers will quickly realize the benefits of the Cairngorm MVC and grow to love its versatility and benefits in most of their Flex projects. With my next blog entries, I will elaborate with details on my bold statements above.</p>                               <p>Meanwhile below is the actually source code changes to the Cairngorm release(s). I will be submitting these changes to the Cairngorm committee in hopes that they will become part of the standard release. </p>                              <p>Here are some resources:<br />                               1) <a href="http://www.cairngormdocs.org/">Cairngorm Docs</a><br />                               2) <a href="http://www.cairngormdocs.org/tools/CairngormDiagramExplorer.swf">Cairngorm Explorer</a>                              <br />                               3) <a href="http://labs.adobe.com/wiki/index.php/Cairngorm">Cairngorm 2.1 Download </a><br />                              4) <a href="http://www.thomasburleson.biz/downloads/Cairngorm2.1_Optimized.zip">Optimized Cairngorm 2.1 Download </a></p>]]>
    </content>
</entry>
<entry>
    <title>The Incomplete Guide to Flex Events (Part 1 of 4)</title>
    <link rel="alternate" type="text/html" href="http://www.thomasburleson.biz/2006/07/the_incomplete_guide_to_flex_e.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://thomasburleson.biz/blog-mt/mt-atom.cgi/weblog/blog_id=3/entry_id=6" title="The Incomplete Guide to Flex Events (Part 1 of 4)" />
    <id>tag:www.thomasburleson.biz,2006://3.6</id>
    
    <published>2006-07-17T22:10:35Z</published>
    <updated>2007-07-08T17:00:21Z</updated>
    
    <summary>When building Flex2 applications, developers have four (4) categories of events that may need to be considered in their custom applications: (1) system events, (2) user events, (3) business events, and (4) data service events.</summary>
    <author>
        <name>Thomas Burleson</name>
        <uri>www.UniversalMind.com</uri>
    </author>
            <category term="Cairngorm" />
            <category term="Flex" />
    
    <content type="html" xml:lang="en" xml:base="http://www.thomasburleson.biz/">
        <![CDATA[<p align="left">When building Flex2 applications, developers have <u>four (4) categories of events</u> that may need to be considered in their custom applications: (1) <span style="color: rgb(0, 0, 170); font-weight: bold">system</span> events, (2) <span style="color: rgb(0, 0, 170); font-weight: bold">user</span> events, (3) <span style="color: rgb(0, 0, 170); font-weight: bold">business</span> events, and (4) <span style="color: rgb(0, 0, 170); font-weight: bold">data service</span> events.  </p>  <p>I personally think the term <span style="color: rgb(255, 0, 0); font-size: 10px"><u>system event</u></span> is ambiguous. For example does &quot; <span style="color: rgb(255, 0, 0); font-size: 10px"><u>system</u></span>&quot; refer to the OS system or the FlashPlayer system or the MX Framework system... such ambiguity forces me remind the reader that these events are the Flex 2 Framework system events. In the sebsequent paragraphs, we will learn about these four event categories and how they impact our thoughts regarding Flex development.</p>  <p align="left">The Flex2 framework provides superb native support for system, user, and data service events. Developers must create their own business events and must take special care to use the data service events appropriately. This 4-part guide really focuses on the concepts and uses of <span style="color: rgb(0, 0, 170); font-weight: bold">business</span> and <span style="color: rgb(0, 0, 170); font-weight: bold">data service</span> event categories. Before we can properly discuss such topics, however, let's first review the concepts and issues with <span style="color: rgb(0, 0, 170); font-weight: bold">system</span> and <span style="color: rgb(0, 0, 170); font-weight: bold">user</span> events.  </p>]]>
        <![CDATA[<div style="font-size: 12px; color: rgb(0, 0, 255); font-weight: bold">SECTION 1: <u>System Events</u></div>   <p align="left">We assume the Flex developer has a base familiarity with system and user events, but may not be aware of the distinctions between the system and user event categories. System events are events that are never generated directly by the user. Instead these events are generated by code activity within the mx framework; events that usually occur during application startup, component creation, component layout/measuring, and more. Such events include creationComplete, initialize, show, hide, etc. </p>    <p> </p><p>Developers may &quot;hook&quot; or capture these events using built-in event stubs and custom event handlers. The event stub is the location where you specify your event handler and usually has the same name as the event itself. The Flex2 framework provides a multitude of built-in event stubs for both system and user events. </p>     <p> <img border="0" src="http://blog.universalmind.com/enclosures/ExampleStubHanlder.gif" />  <br /> </p><p> 		 		<a name="more" /> 		</p><p>In examples 1 and 2 below the event &quot;stub&quot; [or hook location] is the creationComplete=&quot;&quot;. The event &quot;handler&quot; is the code inside the &quot;&quot; on the right side of the creationComplete stub. In our examples, we want to insert code that will be executed when the areaAlert component announces that its creation process is done or completed. Example 1 uses inline actionscript to specify our code. Example 2 uses specifies a custom function or method that will be executed when the event handler is invoked. If the event stub is empty [ &quot;&quot; ] - in other words, does not have an event handler - then the creationComplete event is <u>still</u> fired by the component but no event handler is executed.</p>    <p> </p><p>  Below are two equivalent examples of <span style="color: rgb(255, 0, 0); font-size: 12px"><u>system event</u></span> hooks:</p>  <br />  <span style="color: rgb(0, 0, 255)"><u> Example 1</u></span><br />  <br />  <img border="0" src="http://blog.universalmind.com/enclosures/Example11.gif" />  <br />   <span style="color: rgb(0, 0, 255)"><u> Example 2</u></span> <br />   <br />  <img border="0" src="http://blog.universalmind.com/enclosures/Example2.gif" />    <p> </p><p>Please note: as a course of &quot;<span style="color: rgb(0, 102, 0); font-weight: bold"><u>best practices</u></span>&quot;, inline actionscript is fine for short 1 code segments [like above]. Explicit method calls as event handlers - e.g. announceReady() - are better used for multiple code segments. This keeps your &lt;mx .../&gt; tags clean and easily managed. Example 3 below shows an multi-line event handler.</p>   <br />  <span style="color: rgb(0, 0, 255)"><u> Example 3</u></span> <br />  <img border="0" src="http://blog.universalmind.com/enclosures/Example3.gif" />    <p> </p><p>  In various portions of my article I will identify features of the Flex2 platform where <span style="color: rgb(255, 0, 0); font-weight: bold">compiler MAGIC</span> occurs. By this, I mean activity such as custom tags that are transparently converted to actionscript code or inline actionscript code that is converted during compiler processes... all these can be viewed as &quot;<span style="color: rgb(255, 0, 0); font-weight: bold">MAGIC</span>&quot; because we never see it happening and it saves us - the developer - an amazing amount of manual work; thus allowing us to keep our code uncluttered with tedious details.</p>  <p>Earlier we stated that examples 1 and 2 are equivalent. When the Flex code in Example 1 is compiled, the inline actionscript is first converted to a distinct method [analogous to the announceReady() method shown in the script section of Example 2]. But you never see this hidden conversion process.... <span style="color: rgb(255, 0, 0); font-weight: bold">MAGIC</span>!</p>     <p>     </p><p> My next posting will continue with Part 2 of 4: <span style="color: rgb(0, 0, 102); font-size: 10px"><u>User Events</u></span>... so stay tuned! </p>]]>
    </content>
</entry>
<entry>
    <title>Flex Data Services - FlexStore and Inventory Demo</title>
    <link rel="alternate" type="text/html" href="http://www.thomasburleson.biz/2006/07/flex_data_services_flexstore_a.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://thomasburleson.biz/blog-mt/mt-atom.cgi/weblog/blog_id=3/entry_id=5" title="Flex Data Services - FlexStore and Inventory Demo" />
    <id>tag:www.thomasburleson.biz,2006://3.5</id>
    
    <published>2006-07-16T20:18:06Z</published>
    <updated>2007-07-08T17:00:21Z</updated>
    
    <summary>During that presentation I outlined the major features of FDS and how they integrate with Coldfusion web applications. I discussed which features FDS features were automatically available in ColdFusion 7.02 Enterprise: specifically HTTPService and Remoting to CFCs. I also tried to highlight when a development project will need to obtain a separate licensed copy of the full FDS installation.</summary>
    <author>
        <name>Thomas Burleson</name>
        <uri>www.UniversalMind.com</uri>
    </author>
            <category term="Coldfusion" />
            <category term="Flex" />
            <category term="Flex Data Services" />
    
    <content type="html" xml:lang="en" xml:base="http://www.thomasburleson.biz/">
        <![CDATA[<p>   I recently presented at the CFUnited 2006 Conference. My 1-hour presentation was titled <span style="color: rgb(0, 0, 255)">&quot;Flex 2.0 Data Services (FDS) and ColdFusion &ndash; 203&quot;</span>. During that presentation I outlined the major features of FDS and how they integrate with Coldfusion web applications. I discussed which features FDS features were automatically available in <span style="color: rgb(0, 0, 255)">ColdFusion 7.02 Enterprise</span>: specifically <span style="color: rgb(255, 0, 0)">HTTPService</span> and <span style="color: rgb(255, 0, 0)">Remoting to CFCs</span>. I also tried to highlight when a development project will need to obtain a separate licensed copy of the full FDS installation.<br /><br /></p>]]>
        <![CDATA[A copy of that presentation is available for download here: <a target="_blank" title="Flex 2.0 Data Services with Coldfusion" href="http://www.thomasburleson.biz/downloads/cfunited_06_ThomasBurleson.ppt">Download PowerPoint Presentation</a>.   <div>     <p>   </p><p>At the end of my slide presentation, I then showed the audience a demonstration of <span style="color: rgb(255, 0, 0)">Flex Real-time Messaging</span> using two Flex applications: the <span style="color: rgb(0, 102, 0)">FlexStore</span> and a sample <span style="color: rgb(0, 102, 0)">Inventory Dashboard </span>applications. This demo was originally created by Robert Tiernay @ Abobe. With his permission I presented a modified version. Here is the scenario presented: <br /></p><ul><p align="left">&bull; The user opens a web browser and uses the FlexStore application to purchase Nokia phones. After the user places 1 or more phones items into his shopping cart, he can then select the 'Submit' order button.<br /><br />      <img width="360" height="216" border="0" alt="FlexStore Image" src="http://blog.universalmind.com/enclosures/FlexStore.jpg" /><br /><br />  &bull; Meanwhile, the store manager is using the Inventory Dashboard application to get <u>real-time</u> updates regarding the current inventory status. The Dashboard app also shows him when the inventory quantity is below a &quot;threshold&quot; level and more Nokia phones should be ordered. <br />  <br />  <img width="303" height="205" border="0" alt="Inventory Image" src="http://blog.universalmind.com/enclosures/InventoryDashboard.jpg" /><br /></p></ul> The interesting features of this demo are (1) the dashboard never needs to refresh to get updated data, and the dashboard is NOT continually polling the server for updates... instead (2) the server &quot;<span style="color: rgb(255, 0, 0)">pushes</span>&quot; inventory changes whenever an order is submitted. In fact the demo FlexStore has a batch mode that randomly changes the quantities of each item in the shopping cart and then incrementally submits the order for each item separately. This allows users to see the Inventory Dashboard change as multiple orders/inventory changes are submitted over a period of time. <p>At least 20 attendees asked for source code to that demo. That source and the presentation slides - along with a video of the presentation - will be available online at the CFUnited site soon. In the interim, here is the source code for the FlexStore Ordering - Live Inventory Dashboard demo(s).&nbsp; I have included in the .zip archive some configuration instructions with the source. I hope you enjoy the demo(s)&nbsp;and the thought-provoking ideas that it generates.&nbsp;</p>    <p>Included with the source code are instructions for the installation steps required to properly install and run the attached FDS demo(s): those instructions include details for both <u>client</u> and <u>server</u> configurations. Click here to<span style="color: rgb(255, 0, 0)"> <a target="_blank" href="http://www.thomasburleson.biz/samples/ColdfusionWithFDS.zip">download</a> </span><span class="blogText">the </span><span style="color: rgb(255, 0, 0)">FlexStore/Inventory Dashboard</span> source code. </p>  </div>]]>
    </content>
</entry>
<entry>
    <title>Elastic Cords - Porting a Flash8 application to Flex 2</title>
    <link rel="alternate" type="text/html" href="http://www.thomasburleson.biz/2006/03/elastic_cords_porting_a_flash8.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://thomasburleson.biz/blog-mt/mt-atom.cgi/weblog/blog_id=3/entry_id=4" title="Elastic Cords - Porting a Flash8 application to Flex 2" />
    <id>tag:www.thomasburleson.biz,2006://3.4</id>
    
    <published>2006-03-18T12:29:31Z</published>
    <updated>2007-07-08T17:00:21Z</updated>
    
    <summary>Porting a timeline-based Flash 8 application to Flex 2 required an deep understanding of the new features of Flex 2. This sample application with source code will demonstrate the solutions to many of the porting issues involved.</summary>
    <author>
        <name>Thomas Burleson</name>
        <uri>www.UniversalMind.com</uri>
    </author>
            <category term="Flash" />
            <category term="Flex" />
    
    <content type="html" xml:lang="en" xml:base="http://www.thomasburleson.biz/">
        <![CDATA[<p> 		Recently <a href="http://www.ericd.net/new_css/">Eric Dolecki</a> published a Flash 8 version of a very cool <strong>Elastic Cords</strong> flash application. I am sure he was - as I am - inspired by the works of <a href="http://void.andre-michelle.com/">Andre Michelle</a>. This application, of course, does nothing commercially practical but does demonstrate great features of the FP8 API. I, of course, decided to continue that tradition. I wanted to create a Flex, object-oriented, component version...<br /><br /></p>]]>
        <![CDATA[Recently <a href="http://www.ericd.net/new_css/">Eric Dolecki</a> published a Flash 8 version of a very cool <strong>Elastic Cords</strong> flash application. I am sure he was - as I am - inspired by the works of <a href="http://void.andre-michelle.com/">Andre Michelle</a>. This application, of course, does nothing commercially practical but does demonstrate great features of the FP8 API. I, of course, decided to continue that tradition. <p>All too often I find great Flash applications; but their code (if published) is usually procedural and timeline-based instead of the component-based approaches that come so easily to us in Flex 2. This is to be expected since Flash 8 is a tool intended primarily for designers. While Flex is a tool oriented primarily for developers.</p><p> Porting such applications from Flash 8 to Flex 2 - where the concepts of timelines are deprecated - presents challenges. When you consider that most Flex projects are business-oriented applications that do not require dynamic stage-drawing interactions (like the <strong>Elastic Cords</strong>), then this project was the perfect impetus for me to explore and understand the conceptual differences; differences such UI interactions, tweenings, component coupling, etc.. </p>  <p>I knew the effort would prove to be quite fun and challenging. In fact, I became obssessed first with the development efforts and then with dragging those ridiculous cords around.[So be forewarned ;-)] <br /><br /> </p>  <p align="center"><a title="Elastic Cords" target="_blank" href="/samples/elasticCords.html"><img width="440" height="318" border="0" src="http://blog.universalmind.com/enclosures/snapshot.jpg" /></a><br />Click image to run live version... requires Flash Player <u>9.xx</u><br /></p>  <p>My Flex 2 version of <strong>Elastic Cords</strong> is a completely OO component-based application that uses canvases, sprites, tweens, effects, filters, bindings, and more. Run the live application and play with it. 'View Source' has also been enabled for developers to review the code, architectures, and techniques. And soon... I will provide tutorials to walk developers thru the porting process. </p><p>    </p><p> Interestingly enough, I had 2 options when building my Flex2 application: (1) Use a <strong>Actionscript project</strong> or (2) use a <strong>Flex project</strong> that would include the mx framework. The actionscript project would have been &lt; 30K while the existing Flex applicaiton is ~200K. But without the mx framework, I would have lost pre-built components &amp; containers, bindings, etc. And the resulting version is easily extendable. So the larger footprint (for the core mx libraries) was well worth it.</p>]]>
    </content>
</entry>

</feed> 

