<?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"
	>

<channel>
	<title>The Morphic Group</title>
	<atom:link href="http://www.themorphicgroup.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.themorphicgroup.com/blog</link>
	<description></description>
	<pubDate>Fri, 19 Dec 2008 17:37:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Holiday Gift from The Morphic Group</title>
		<link>http://www.themorphicgroup.com/blog/2008/12/19/holiday-gift-from-the-morphic-group/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/12/19/holiday-gift-from-the-morphic-group/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 17:37:10 +0000</pubDate>
		<dc:creator>Sam Roach</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=63</guid>
		<description><![CDATA[It&#8217;s the season of giving, and The Morphic Group Lab has two presents with your name on them. While it&#8217;s true that The Morphic Group is known for heavy-duty engineering in Flash, Flex, and AIR, we like to cut loose and play a few games now and then too.
Our engineers have been sneaking away from [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s the season of giving, and The Morphic Group Lab has two presents with your name on them. While it&#8217;s true that The Morphic Group is known for heavy-duty engineering in Flash, Flex, and AIR, we like to cut loose and play a few games now and then too.</p>
<p>Our engineers have been sneaking away from work and tinkering around in the lab (along with a few elves) during this year to create these two winter-themed games for you to play and share with friends and family. We hope you enjoy our gift to you.</p>
<p><a title="Seasons Greetings" href="http://www2.themorphicgroup.com/holiday/"  target="_self">Take me to The Morphic Group Labs</a></p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/12/19/holiday-gift-from-the-morphic-group/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Gumbo and itemRendererFunction to create multiple ItemRenderers</title>
		<link>http://www.themorphicgroup.com/blog/2008/12/03/using-gumbo-and-itemrendererfunction-to-create-multiple-itemrenderers/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/12/03/using-gumbo-and-itemrendererfunction-to-create-multiple-itemrenderers/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 18:11:36 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=61</guid>
		<description><![CDATA[
	Gumbo has added an &#34;itemRendererFunction&#34; function that allows certain data containers to specify an itemRenderer based on the data item. In this example an FxDataContainer&#8217;s dataProvider is set to an ArrayCollection that contains 2 different types of Value Objects. Depending on the type of Value Object the itemRendererFunction returns a different itemRenderer.

    [...]]]></description>
			<content:encoded><![CDATA[<p>
	<a href="http://labs.adobe.com/technologies/gumbo/" onclick="javascript:pageTracker._trackPageview('/outbound/article/labs.adobe.com');" target="_blank">Gumbo</a> has added an &quot;itemRendererFunction&quot; function that allows certain data containers to specify an itemRenderer based on the data item. In this example an FxDataContainer&#8217;s dataProvider is set to an ArrayCollection that contains 2 different types of Value Objects. Depending on the type of Value Object the itemRendererFunction returns a different itemRenderer.</p>
<p style="20px;">
<p>    <a href="http://www2.themorphicgroup.com/projects/examples/itemrendererfunction"  target="_blank"><img src="http://www2.themorphicgroup.com/projects/examples/img/itemRendererFunction.png" width="200" height="149" alt="" border="none" /></a><br />
<br />
    <a href="http://www2.themorphicgroup.com/projects/examples/itemrendererfunction"  target="_blank"><strong>View Example</strong> (right click for source)</a>
</p>
<p>In this example there are two different Value Objects: PhotoVO and QuoteVO. An FxDataContainer&#8217;s dataProvider is set to an ArrayCollection:</p>
<pre>
[Bindable]private var VODataProvider:ArrayCollection;
&lt;FxDataContainer dataProvider=&#8221;{VODataProvider}&#8221;&#8230;
</pre>
<p>
	The ArrayCollection is populated with 5 Value Objects, 2 PhotoVO and 3 QuoteVO.
</p>
<p>In the FxDataContainer the itemRendererFunction is set to a function:</p>
<pre>&lt;FxDataContainer dataProvider="{VODataProvider}"
	itemRendererFunction="itemRendererFunction_handler"
</pre>
<p>In the itemRendererFunction a ClassFactory is passed back based on the type of data item in the itemRenderer. In this example there is a different itemRenderer for the PhotoVO and QuoteVO. We will also pass in a function to the itemRenderer to handle clicks:</p>
<pre>
private function itemRendererFunction_handler(item:Object):ClassFactory {
	var classFactory:ClassFactory;
	if (item is PhotoVO) {
		//item is PhotoVO so use Photo ItemRenderer
		classFactory = new ClassFactory(PhotoItemRenderer);
	} else if (item is QuoteVO) {
		//item is QuoteVO so use Quote ItemRenderer
		classFactory = new ClassFactory(QuoteItemRenderer);
	}
	//pass callback click function
	classFactory.properties = {clickFunction:itemRenderClick_handler};
	return classFactory;
}
</pre>
<p>
<a href="http://www2.themorphicgroup.com/projects/examples/itemrendererfunction"  target="_blank">View Example</a> with source enabled (flash 10 required)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/12/03/using-gumbo-and-itemrendererfunction-to-create-multiple-itemrenderers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Gumbo and Catalyst Photo Viewer Application</title>
		<link>http://www.themorphicgroup.com/blog/2008/12/03/gumbo-and-catalyst-photo-viewer-application/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/12/03/gumbo-and-catalyst-photo-viewer-application/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 18:07:47 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=60</guid>
		<description><![CDATA[I&#8217;ve posted an example of a Flex application created with the MAX preview versions of Flash Catalyst and Gumbo. This small demo application was created to test out some of the new features in both Catalyst and Gumbo. It is not a perfect project, but a starting point for further projects.

	
    
 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve posted an example of a Flex application created with the MAX preview versions of Flash Catalyst and Gumbo. This small demo application was created to test out some of the new features in both Catalyst and Gumbo. It is not a perfect project, but a starting point for further projects.</p>
<p style="20px;">
	<a href="http://www2.themorphicgroup.com/projects/catalystgumbophoto/"  target="_blank"><img src="http://www2.themorphicgroup.com/projects/examples/img/gumbo_app.png" width="215" height="157" alt="Gumbo Catalyst Photo Application" border="none" /></a><br />
    <br />
    <a href="http://www2.themorphicgroup.com/projects/catalystgumbophoto/"  target="_blank"><strong>View Example</strong> (right click for source)</a>
</p>
<p>The main goal of this project was to play with the new features in Catalyst and Gumbo using a close to real world example application, here is what was done:</p>
<ul>
<li>Start with a photoshop layout (PhotoShop file located in PSD directory)</li>
<li>Use Catalyst to layout/components/skins and export FXG project</li>
<li>Import FXG to Gumbo project</li>
<li>In Gumbo add data/photo/etc functionality to the project</li>
<li>Take project back to Catalyst for small visual edits, then back to Gumbo</li>
<li>Use new Gumbo MXML tags/components</li>
<li>Play with new Vector (using the new BitmapData.histogram)</li>
</ul>
<p>
	Instead of detailing every step of the process there is great <a href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo#Gumbo-DocumentsandSpecifications" onclick="javascript:pageTracker._trackPageview('/outbound/article/opensource.adobe.com');" target="_blank">Gumbo Documentation</a> and <a href="http://thermoteamblog.com/category/started/" onclick="javascript:pageTracker._trackPageview('/outbound/article/thermoteamblog.com');" target="_blank">Catalyst Examples</a>.
</p>
<p>
	<a href="http://www2.themorphicgroup.com/projects/catalystgumbophoto/"  target="_blank"><strong>View Catalyst and Gumbo Photo Application</strong></a> (requires Flash 10 player)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/12/03/gumbo-and-catalyst-photo-viewer-application/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Deconstruction and reconstruction of a ByteArray</title>
		<link>http://www.themorphicgroup.com/blog/2008/12/02/deconstruction-and-reconstruction-of-a-bytearray/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/12/02/deconstruction-and-reconstruction-of-a-bytearray/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 17:59:57 +0000</pubDate>
		<dc:creator>Dennis</dc:creator>
		
		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=59</guid>
		<description><![CDATA[Many times you may come up with tasks that seem pretty straight forward but involve a bit of researching. In a recent project, I needed to find a way pass a dynamically generated image from one flex application (swf) to another. My senior developer suggested that I pass the ByteArray data of the image via [...]]]></description>
			<content:encoded><![CDATA[<p>Many times you may come up with tasks that seem pretty straight forward but involve a bit of researching. In a recent project, I needed to find a way pass a dynamically generated image from one flex application (swf) to another. My senior developer suggested that I pass the ByteArray data of the image via local connection. But there is one small problem. There is a size limit for local connection, 40K. So the original data needs to be cut into smaller pieces, sent via LC and then reconstructed into the complete image data. (Note: LC = Local Connection)</p>
<p>I would suggest creating a unique local connection name between your applications (swfs). Check out Joey’s blog on this task - <a href="http://www.themorphicgroup.com/blog/2008/05/30/unique-local-connection-names/"  target="_blank">unique local connection names</a>. In this project summary, I will not reference a unique connection name.</p>
<p>Here is the set up… In the first swf, I’ve set up a LC object (transSendLC) and an image object (imgOriginal). The second app (swf) somewhat mimics the first app (swf). The only difference is that I created a custom class, inheriting from LC. I’ve added a method for receiving the ByteArray and a Bitmap object. The bitmap object can be used to bind to the Image source. Note: You don’t need to create a custom class. I found that it made sense for my particular flex project.</p>
<p>Within my first app (swf), I have supplied an image (imgOriginal). Now with I need to chop up the data and send it to the second app (swf).</p>
<pre>
<code>
Example Code:
...
var width:Number = imgOriginal.width
var height:Number = imgOriginal.height;
var bytes:ByteArray =
   imgOriginal.bitmapData.getPixels(new Rectangle(0, 0, width, height))

var tempByteArray:ByteArray;

// limit byteArray to 40K - localconnection limit
var byteLimit:uint = uint(40000);

if(bytes.length &gt; byteLimit){

   var currentSize:uint = byteLimit;
   var position:uint = 0;
   var totalSize:uint = 0;

   while(totalSize &lt; bytes.length){
      tempByteArray = new ByteArray();
      tempByteArray.length = currentSize;

      // Write bytes from position to current size
      tempByteArray.writeBytes(bytes, position, currentSize);

      //send ByteArray chunk
      transSendLC.send(uniqueLCName, "sendSnapShot",
              tempByteArray, bytes.length, width, height);

      //get current total and get next position
      totalSize = totalSize + tempByteArray.length;
      position = totalSize;

      //set current size based on limit
      currentSize = bytes.length - totalSize;
      if(currentSize &gt;  byteLimit){
         currentSize = byteLimit;
      }
  }
  else{
     //less than limit - send Byte Array
     bytes.writeBytes(tempByteArray, 0, uint(bytes.length));
     imgLCSend.send(uniqueLCName, "sendByteArrayData",
                 tempByteArray, bytes.length, width, height);
  }
...
</code>
</pre>
<p>Next in my second app (swf), I need to build the sendCopy method within my custom object (inheriting from LC). Note: It is assumed that you have logic to connect the shared local connection name, a Bitmap and a ByteArray object in your custom class.</p>
<pre>
<code>
Example Code:
public function sendByteArrayData(bytes:Object, bytesLength:Number,
                              width:Number, height:Number):void {
   var byteArray:ByteArray = bytes as ByteArray;

   //New ByteArray size
   if(byteArraySnapShot == null){
      byteArraySnapShot = new ByteArray();
      byteArraySnapShot.length = bytesLength;
      byteArraySnapShot.position = 0;
   }

   //Write byte array
   byteArraySnapShot.writeBytes(byteArray);

   //Once length/size is filled based on total bytes create bitmap
   if(byteArraySnapShot.bytesAvailable == 0){
      var bitmapDataSnapShot:BitmapData = new BitmapData(width, height);
      byteArraySnapShot.position = 0;
      bitmapDataSnapShot.setPixels(new Rectangle(0, 0, width, height),
            byteArraySnapShot);

      var bitmapSnapShot:Bitmap = new Bitmap(bitmapDataSnapShot);
      snapShotImg = bitmapSnapShot;

      byteArraySnapShot = null;
   }

}

</code>
</pre>
<p>There perhaps a few ways to achieve the functionality.  My purpose here is to show the process of reading and writing ByteArray in a real world application set.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/12/02/deconstruction-and-reconstruction-of-a-bytearray/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Awesome to the (Max 2008)</title>
		<link>http://www.themorphicgroup.com/blog/2008/11/26/awesome-to-the-max-2008/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/11/26/awesome-to-the-max-2008/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 14:38:37 +0000</pubDate>
		<dc:creator>Dennis</dc:creator>
		
		<category><![CDATA[Adobe AIR]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[News]]></category>

		<category><![CDATA[Reviews]]></category>

		<category><![CDATA[adobe]]></category>

		<category><![CDATA[Adobe Max 2008]]></category>

		<category><![CDATA[Event]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=58</guid>
		<description><![CDATA[
In the last couple of days, I decided to go through my notes, collect all the presentation files (powerpoints, pdfs and zips) and find blogs that reference the keynotes. Essentially I wanted to reflect and review &#8220;the Happening&#8221; that was Adobe Max 2008, my first Max.
For the most part I was impressed with this, my [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><img src="http://www2.themorphicgroup.com/pictures/HeaderMax.jpg" alt="" width="600" height="145" /></p>
<p class="MsoNormal">In the last couple of days, I decided to go through my notes, collect all the presentation files (powerpoints, pdfs and zips) and find blogs that reference the keynotes. Essentially I wanted to reflect and review &#8220;the Happening&#8221; that was Adobe Max 2008, my first Max.</p>
<p class="MsoNormal">For the most part I was impressed with this, my first, Adobe convention. It did not fail to inspire and to inform developers and designers on the future of Adobe and their products. In fact, when I got home I wanted to buy the latest Creative Suite right away, based on the feeling that I&#8217;m missing out on new and exciting features. Call it the rabid consumer in me. Like all the conventions I&#8217;ve attended in the past, I feel that most of the session only skimmed the surface of what I expected to learn. Keep in mind that I&#8217;ve attended Flash in the Can three times and FlashForward last year. The big difference is the session security lock up. You had to be assign to you time slot session via your id card. If you changed your mind, you had to log in to the system and change your schedule. In other conventions, you could wonder around to another session if the assigned session you were slated to attend went south. I can understand this method reduces the congestion and interruptions of people running around and crashing into the middle of a presentation.  My hat goes off to anyone who prepares and presents ideas to a group as large as the Max crowd or any crowd for that matter.</p>
<p>These are the sessions that impressed me the most in no particular order:<br />
<strong> The Flex Architecture Faceoff</strong> -  &#8220;to be or not to be&#8221; using a Framework. It had as much drama as a Shakespeare play - Starring Todd Anderson, Josh Noble, Chafic Kaznoun and Yakov Falin. I only wish it could have lasted a bit longer. Chafic and Yakov voiced their disdain for using a framework in projects. The idea being that they contain a lot of code that can be unnecessary. They found that an &#8220;al a carte&#8221; setup with a smaller, tighter group of developers is best for their projects. Ideally using a blackbox approach, passing data providers, is what one should strive for. Other suggestions include passing events on data changes rather than using data binding and using code generation. If there was an opposing side to this argument, it was held by both Josh and Todd. They touted that frameworks are best in large group project where developer level may vary. It is also a means to standardize the work/code. This makes it easier for another developer to maintain the project after the fact. Cairngorm was the framework most referenced in the discussion. There was also a discussion on using Prana with Cairngorm (<a href="http://www.pranaframework.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.pranaframework.org');" target="_blank">http://www.pranaframework.org/</a>), to implement inversion of control and dependency injection. From what I understand you can swap out services willy nilly and test object instances via xml file. I heard something about this from the Flex show Podcast. Never used it, but I should definitely try it out. There was a reference to using PureMVC (<a href="http://puremvc.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/puremvc.org');" target="_blank">puremvc.org</a>). No doubt it was a lively discussion. At the end of the session, I think everyone was in agreement on a few points, on when to use and not use a framework. Both sides voiced sensible opinions. Those who attended benefited from their knowledge.</p>
<p><strong>Google Maps with Flash/Air applications</strong>: More dynamic views of the map content (3D), Embed video and animation assets. Now support Air&#8230; What I got out of this session- I&#8217;m interested in building an Air Application using this library verses MapQuest&#8217;s library.</p>
<p><strong>Adobe XDCE - Air User Experience Mode</strong>l - Demos on Aggregators, Utilities, Media Consumers&#8230; Probably the most impressive application demo - the International Herald Tribune - Basically brings the New York Times layout and design to Adobe Air. What I got out of this session, ideas on Air applications that could be built.</p>
<p><strong>Flex framework features to support large applications</strong>:  Build the case for the Marshall Plan - Dividing the work between sub application domains / different versions of Flex Framework. This plan will start to be implemented from Flex 3.2 on up to newer versions. Many limitations - No strong typing, No Managers/Singletons, Security issues, and Remote Object Data services have serializing issues. The idea is to support legacy frameworks from this point forward when updating legacy projects cannot be accomplished. What I got the most out of this session was the idea of using modules, RSL to break up application and make applications faster.</p>
<p><strong>Session on 2Advanced</strong>: I learned that a company that started around the Internet Crash of 2000 happened can still survive and thrive by having employees multitask. I was very impressed with their work ethic and their creative portfolio.</p>
<p><strong>The major keynotes</strong> on Monday and Tuesday focused on The Flash Platform and sneak peeks - Flash Player 10, Adobe Catalyst (Thermo), Adobe Air 1.5, Gumbo (Flex Builder 4)  The major trends - Client and Cloud computing, Social computing, Devices and desktop computing.   They had a small mention of Adobe Alchemy, which allows you to run C/C++ code into Actionscript (hmm interesting).<br />
Links (good accounts of the major keynotes):<br />
<a href="http://flashthusiast.com/2008/11/17/liveblogging-max-2008-day-1-general-session-keynote-click-refresh/#more-102" onclick="javascript:pageTracker._trackPageview('/outbound/article/flashthusiast.com');" target="_blank">http://flashthusiast.com/2008/11/17/liveblogging-max-2008-day-1-general-session-keynote-click-refresh/#more-102</a><br />
<a href="http://flashthusiast.com/2008/11/18/liveblogging-max-sneak-peeks-and-awards-refresh-yo/" onclick="javascript:pageTracker._trackPageview('/outbound/article/flashthusiast.com');" target="_blank">http://flashthusiast.com/2008/11/18/liveblogging-max-sneak-peeks-and-awards-refresh-yo/</a><br />
<a href="http://blogs.adobe.com/pdehaan/2007/10/adobe_max_2007_keynote_day_2_e.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/blogs.adobe.com');" target="_blank">http://blogs.adobe.com/pdehaan/2007/10/adobe_max_2007_keynote_day_2_e.html</a></p>
<p><img src="http://www2.themorphicgroup.com/pictures/KeyNoteMax.jpg" alt="Max Keynote" width="300" height="215" /></p>
<p>I am really thankful that my company (TMG) allowed me to attend this conference. It was great to finally meet my fellow talented Morphicians from the West Coast. This was the crème al la crème of conferences, a way to see what can and will be next in our industry.</p>
<p><img src="http://www2.themorphicgroup.com/pictures/GroupMax.jpg" alt="" width="300" height="175" /></p>
<p class="MsoNormal">Please feel free to respond with comments or any thoughts on Max 2008.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/11/26/awesome-to-the-max-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Architecting Flex Applications Presentation</title>
		<link>http://www.themorphicgroup.com/blog/2008/10/11/architecting-flex-applications-presentation/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/10/11/architecting-flex-applications-presentation/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 15:57:45 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
		
		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=57</guid>
		<description><![CDATA[For those attending the user group meetings where I present on the topic of Architecting Flex Applications you may have interest in downloading the code for the sample application. The sample application is from Programming Flex 3, where you can find more detailed information and explanations about the application itself. However, the code is fairly [...]]]></description>
			<content:encoded><![CDATA[<p>For those attending the user group meetings where I present on the topic of Architecting Flex Applications you may have interest in downloading the code for the sample application. The sample application is from Programming Flex 3, where you can find more detailed information and explanations about the application itself. However, the code is fairly well commented as well, and the application code is a free download. You can download it from the Google Code site using SVN or as a .zip file. If you are using SVN then go to <a title="http://code.google.com/p/flickrflex/source/checkout" href="http://code.google.com/p/flickrflex/source/checkout" onclick="javascript:pageTracker._trackPageview('/outbound/article/code.google.com');" target="_blank">http://code.google.com/p/flickrflex/source/checkout</a> to view the repository URL. If you want to download the code as a .zip then go to <a title="http://code.google.com/p/flickrflex/downloads/list" href="http://code.google.com/p/flickrflex/downloads/list" onclick="javascript:pageTracker._trackPageview('/outbound/article/code.google.com');" target="_blank">http://code.google.com/p/flickrflex/downloads/list</a>. I&#8217;ve also converted the presentation slides to a Google presentation document, which you can view at <a title="http://docs.google.com/Presentation?id=dgr5k2pm_19c64zt3cx" href="http://docs.google.com/Presentation?id=dgr5k2pm_19c64zt3cx" onclick="javascript:pageTracker._trackPageview('/outbound/article/docs.google.com');" target="_blank">http://docs.google.com/Presentation?id=dgr5k2pm_19c64zt3cx</a>.</p>
<p>If you have questions then you can certainly post comments. Since I&#8217;m traveling I cannot guarantee a fast reply. However, I will field comments when possible, and other readers might have useful replies as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/10/11/architecting-flex-applications-presentation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Detroit Presentation (Adobe AIR)</title>
		<link>http://www.themorphicgroup.com/blog/2008/10/09/detroit-presentation-adobe-air/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/10/09/detroit-presentation-adobe-air/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 15:57:59 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
		
		<category><![CDATA[Adobe AIR]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=55</guid>
		<description><![CDATA[The presentation on Adobe AIR in Detroit (technically in Canton, MI) went very well. Thanks to Deborah for helping to organize the event for Refresh Detroit and for bringing together her group and the Detroit Area Adobe User Group for the event. For those in attendance I&#8217;ve just posted the files for the demo application. [...]]]></description>
			<content:encoded><![CDATA[<p>The presentation on Adobe AIR in Detroit (technically in Canton, MI) went very well. Thanks to Deborah for helping to organize the event for Refresh Detroit and for bringing together her group and the Detroit Area Adobe User Group for the event. For those in attendance I&#8217;ve just posted the files for the demo application. You can download them from <a title="http://www.themorphicgroup.com/presentations/2008/airflex/download.zip" href="http://www.themorphicgroup.com/presentations/2008/airflex/download.zip" onclick="javascript:pageTracker._trackPageview('/downloads/presentations/2008/airflex/download.zip');" target="_blank">http://www.themorphicgroup.com/presentations/2008/airflex/download.zip</a>. The code is not commented since I just threw it together and since it is quite simple. It does use standard patterns, and it should be fairly simple to figure out. However, if you have questions you may post them here as comments. Please note that since I&#8217;m traveling it might take a little while before I can address your questions. Also, comments on our blog are moderated, and your comments won&#8217;t show up until one of the administrators can approve your comment (sometimes takes a while since we have to sift through the rest of the fake comments that get posted.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/10/09/detroit-presentation-adobe-air/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Joey Lott&#8217;s Cross-Country Lecture Tour</title>
		<link>http://www.themorphicgroup.com/blog/2008/09/30/joey-lott-cross-country-lecture-series/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/09/30/joey-lott-cross-country-lecture-series/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 19:04:36 +0000</pubDate>
		<dc:creator>Sam Roach</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[Add new tag]]></category>

		<category><![CDATA[Adobe AIR]]></category>

		<category><![CDATA[Flash Events]]></category>

		<category><![CDATA[Flex Conference]]></category>

		<category><![CDATA[Flex Events]]></category>

		<category><![CDATA[Joey Lott]]></category>

		<category><![CDATA[Programming in Flex 3.0]]></category>

		<category><![CDATA[The Morphic Group]]></category>

		<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=54</guid>
		<description><![CDATA[
Joey Lott (author and co-founder/partner at The Morphic Group) has embarked on a cross-country lecture series.
Joey will be speaking to hundreds of developers across the nation on best practices in Flex, Flash and AIR development. As well as teaching, Joey will also be spreading the word on career opportunities at The Morphic Group. 
Here is Joey&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><img style="vertical-align: middle;" src="http://www.flickr.com/photos/31053602@N06/2907294829/" alt="" /></p>
<p><strong><span style="color: #800000;">Joey Lott</span> (author </strong><strong>and co-founder/partner at The Morphic Group) </strong>has embarked on a cross-country lecture series.</p>
<p>Joey will be speaking to hundreds of developers across the nation on best practices in Flex, Flash and AIR development. As well as teaching, Joey will also be spreading the word on career opportunities at The Morphic Group. <a href="http://events.oreilly.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/events.oreilly.com');" target="_blank"></a></p>
<p>Here is Joey&#8217;s tour schedule:</p>
<p><span style="color: #999999;"><strong>Detroit</strong> - September 23</span></p>
<p><strong>St. Louis</strong> - October 4 - <span style="font-size: 12px;"><a href="http://www.as3apex.com/as3/joey-lott-is-coming-to-stlouis-on-october-4th/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.as3apex.com');">AS3 Apex in St. Louis</a></span><br />
Presenting Flex, Actionscript, and Flash. Space is limited so please RSVP.</p>
<p><strong>Cleveland</strong> - October 9 - <span style="font-size: 12px;"><a href="http://www.clefug.com/#app=be07&amp;aec8-selectedIndex=2" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.clefug.com');">Cleveland Flex User&#8217;s Group</a></span><br />
Presenting Flex, Actionscript, and Flash.</p>
<p><strong>Harrisburg </strong> - October 10 - <span style="font-size: 12px;"><a href="http://cenpennaug.blogspot.com/2008/08/adobe-flex-3-author-joey-lott-to-speak.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/cenpennaug.blogspot.com');">Central PA Adobe User Group &amp; Central PA Flash User Group</a></span><strong><span style="font-size: 12px;"><br />
</span></strong>Presenting &#8220;How To Architect Flex Applications.&#8221;<br />
<strong><br />
Philadelphia</strong> - October 22 - <span style="font-size: 12px;"><a href="http://www.phflex.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.phflex.org');">Philadelphia Flex User Group</a></span><strong><span style="font-size: 12px;"><a href="http://www.phflex.org/"><br />
</a></span></strong>Presenting Flex, Actionscript, and Flash.<a href="http://www.phflex.org/"><br />
</a></p>
<p><strong>Raleigh </strong> - October 25 - More information to come.</p>
<p><strong>Lafayette </strong> - November 3 - <span style="font-size: 12px;"><a href="http://acadiana-aug.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/acadiana-aug.org');" target="_blank">Acadiana Adobe User Group </a></span><br />
Joey Lott, author of the upcoming O&#8217;Reilly book Programming Flex 3 will speak on &#8220;How to Architect Flex Applications,&#8221; as well as answer questions! Join us to welcome this noted Flex author to Acadiana!</p>
<p><strong>Austin </strong> - November 5 - <a href="http://portal.blogfusion.com/blogs/austincfug/" target="_blank">Austin CFUG<br />
</a>Joey Lott is internationally recognized as one of the pre-eminent authorities on Adobe Flash technologies. A best-selling author and frequent speaker at industry conferences, Joey strives to inform, engage, and empower his audience.<a href="http://portal.blogfusion.com/blogs/austincfug/" onclick="javascript:pageTracker._trackPageview('/outbound/article/portal.blogfusion.com');" target="_blank"></a></p>
<p><strong>Tucson</strong> - November 10 - <a href="http://www.sazmug.arizona.edu/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.sazmug.arizona.edu');" target="_blank">Tuson Adobe User Group </a><br />
3pm at the Arizona State Museum</p>
<p><em>How To Architect Flex Applications:<br />
</em> When building Flex applications the whole is greater than the sum of its parts. You may know how to work with the pieces of Flex (layout, styling components, data components, etc.) but it&#8217;s still rather easy to get tangled up and frustrated when trying to stitch the piece together into a coherent application. In this presentation we&#8217;ll look at strategies you can use to build Flex applications in the best way possible. Rather than presenting one boiler plate solution as the &#8220;right way&#8221; this presentation looks at the bigger picture and common patterns you can employ.</p>
<p><strong>Phoenix </strong> - November 10 - <a href="http://www.gotoandstop.org/index.php/2008/08/21/special-meeting-111008-how-to-architect-flex-applications-with-joey-lott/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.gotoandstop.org');" target="_blank">GoToAndStop.org</a><br />
We have the great opportunity to hear from Joey Lott on November 10, 2008 @ 8 PM. This will be our last meeting of the year due to the holidays and isn’t on our normal meeting date because of Joey’s travel plans. He’ll be in Tucson on the 10th presenting earlier that day and will make it here at 8 PM to speak.</p>
<p><strong>Las Vegas </strong>- November 13 - <a href="http://vegasflex.org/2008/10/upcoming-noveember-meeting/" onclick="javascript:pageTracker._trackPageview('/outbound/article/vegasflex.org');" target="_blank">VegasFlex</a><br />
We will be having an extra super special event with Joey Lott (yes, THE Joey Lott) giving a presentation on How to Architect Flex Applications.</p>
<div class="postcontent">
<p>This event will be rate N for newbies (those without Flex experience), but will be important to seasoned Flex developers; your code is getting sloppy, and you need you need help.</p>
<p>Since this meeting will be so special please <a href="http://lottvegasflex.eventbrite.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/lottvegasflex.eventbrite.com');" target="_blank">RSVP here</a>.</p>
</div>
<p><strong><br />
Santa Rosa </strong> - November 24 - <span style="font-family: Arial; color: #0000ff; font-size: x-small;"><a href="http://nbaug.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/nbaug.com');" target="_blank">http://nbaug.com/</a></span><span style="font-size: 10pt; font-family: Arial;"><br />
Joey Lott will be presenting on a variety of Flash-related topics. Joey works with ActionScript during the day, and by night he&#8217;s a super-secret international man of mystery, rescuing animals and children from harms way, righting wrongs, working for global peace and the rights of all living beings and the environment. Joey is the author (or co-author) of a veritable arsenal of ActionScript and Flash-related titles, including the <em><span style="font-family: Arial;">ActionScript Cookbook, Programming Flash Communication Server, </span></em>and the <em><span style="font-family: Arial;">Flash 8 Cookbook.</span></em> In his free time he likes to write poetry, pursue competitive origami, and train in the art of aikido</span></p>
<p><strong>Salt Lake City</strong> - December 2 - More information to come.</p>
<p><strong>Seattle - </strong> December 8  - <span style="font-size: 10pt; color: #1f497d;"><a href="http://www.seaflexug.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.seaflexug.org');" target="_blank">http://www.seaflexug.org</a></span><span style="font-size: 10pt; font-family: Arial;"><br />
Joey will be speaking to the Seattle Flex User Group on December 8<sup>th</sup> at 6:30pm at the Adobe campus in Seattle.  He’ll discuss deep linking in Flex applications.  The Seattle Flex User Group meets monthly to hear from distinguished Flex developers and network with one another.  Past presenters have included members of the Flex engineering team, inventors of technologies built around Flex, and businesses whose services are built with Flex to name a few.  The meetings are open to all who are interested, regardless of experience. </span></p>
<p><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if !mso]><span class="mceItemObject"   classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></span></p>
<style>
st1\:*{behavior:url(#ieooui) }
</style>
<p><![endif]--></p>
<p><a href="http://events.oreilly.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/events.oreilly.com');" target="_blank">&gt; For additional information click here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/09/30/joey-lott-cross-country-lecture-series/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Morphic Group Sponsors CS4 Event in San Fransisco</title>
		<link>http://www.themorphicgroup.com/blog/2008/09/26/the-morphic-group-sponsors-cs4-event-in-san-fransisco/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/09/26/the-morphic-group-sponsors-cs4-event-in-san-fransisco/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 18:51:47 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=52</guid>
		<description><![CDATA[The Morphic Group is happy to be a sponsor for the &#8220;It&#8217;s Going to be Brilliant&#8221; launch event Adobe® Creative Suite® 4 in San Fransisco.
Be among the first to see the CS4 big picture at this special joint meeting of 7 Northern California user groups hosted by Adobe. Enjoy free pizza and special prizes.
If you [...]]]></description>
			<content:encoded><![CDATA[<p>The Morphic Group is happy to be a sponsor for the &#8220;It&#8217;s Going to be Brilliant&#8221; launch event Adobe® Creative Suite® 4 in San Fransisco.</p>
<p>Be among the first to see the CS4 big picture at this special joint meeting of 7 Northern California user groups hosted by Adobe. Enjoy free pizza and special prizes.</p>
<p>If you are in the San Fransisco area please join us:<br />
When: September 30, 2008 at 6:30 PM<br />
Where: Adobe San Francisco Building - 601 Townsend at 7th<br />
Cost: FREE!!</p>
<p>RSVP: http://www.baadaug.org/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/09/26/the-morphic-group-sponsors-cs4-event-in-san-fransisco/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Example of Feature Rich ItemRenderers in Flex</title>
		<link>http://www.themorphicgroup.com/blog/2008/09/15/example-of-feature-rich-itemrenderers-in-flex/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/09/15/example-of-feature-rich-itemrenderers-in-flex/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 22:00:39 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[itemrenderer]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=51</guid>
		<description><![CDATA[
In response to some requests I got from friends wanting some more real world ItemRenderer examples, here is one that approaches the item renderer from a graphical approach and brings together some different techniques to create a nicely featured ItemRenderer.


Here is what this example DataGrid/ItemRender demonstrates:


MXML based ItemRenderer
Override ItemRenderer &#8217;set data&#8217; have data as a [...]]]></description>
			<content:encoded><![CDATA[<p>
In response to some requests I got from friends wanting some more real world ItemRenderer examples, here is one that approaches the item renderer from a graphical approach and brings together some different techniques to create a nicely featured ItemRenderer.
</p>
<p>
Here is what this example DataGrid/ItemRender demonstrates:
</p>
<ul>
<li>MXML based ItemRenderer</li>
<li>Override ItemRenderer &#8217;set data&#8217; have data as a known ValueObject</li>
<li>Swap icons/images based on data values</li>
<li>Highlight selected ItemRenderer</li>
<li>Enable ItemRenderer to dispatch an event to remove a person from the grid</li>
</ul>
<div style="center;">
<a href="http://www.leavethatthingalone.com/examples/flex/itemrenderer01" target="_blank"><br />
<img src="http://www.leavethatthingalone.com/examples/flex/itemrenderer01/itemrenderer_01_post.png" width="369" height="142" border="0" /><br />
<strong>View the Example with source enabled</strong><br />
</a>
</div>
<p>
    <strong>DataProvider and ValueObjects</strong><br />
    The first thing we&#8217;ll look at in the example is the data and data provider for the Grid. Keep in mind this is just a quick demo way to load sample data, the goal is to create an ArrayCollection of  Value Objects. The sample XML data is loaded via an HTTPService. When the result comes back from the service we cast the result as an ArrayCollection, we then loop through each item in that result ArrayCollection. Each item is an Object containing the &#8216;person&#8217; data defined in the XML. For this example we want to place each person data in a person ValueObject (VO). This VO provides a known data type that we will use as the &#8216;data&#8217; in the ItemRenderer. Often when using AMF taking to ColdFusion/BlazeDS/Java/Etc the VO will be aliased to a data type on the server, so this example simulates the DataGrid provider being an ArrayCollection of VOs.<br />
	<br />
    This result function populates the DataProvider with our Person VOs:
</p>
<pre>
private function httpResult_handler(evt:ResultEvent):void {
	if (evt.result.people.person) {
		//result
		var resultAC:ArrayCollection = evt.result.people.person as ArrayCollection;
		//loop through each item in data
		for (var i:int=0;i&lt;resultAC.length;i++) {
			//create person VO
			var person:Person = new Person();
			//add data
			person.fill(resultAC[i]);
			//add person to main data provider
			peopleDataProvider.addItem(person);
		}
	}
}
</pre>
<p>
<strong>ItemRenderer and Override of &#8217;set data&#8217;</strong><br />
Next we&#8217;ll look at how the data is dealt with inside the ItemRenderer. The DataGrid&#8217;s only column is set to have an ItemRenderer. When the DataProvider is populated the DataGrid is going to set the &#8216;data&#8217; property on each row&#8217;s ItemRenderer with the the associated VO in the DataProvider ArrayCollection. We want to make sure that the data inside the ItemRenderer is actually a Person VO object (not a generic Object), so we need to override the &#8217;set data&#8217; function. When we override this function we are now able to cast the data value as a Person VO. This will allow us to refer to data inside the ItemRenderer as that VO with known attributes rather than a generic Object that it would otherwise be:
</p>
<pre>
[Bindable]private var person:Person;
override public function set data(value:Object):void {
	super.data = value;
	if (value is Person) {
		person = Person(value);
	}
}
</pre>
<p>
When overriding the set data function make sure to remember set &#8217;super.data=value&#8217;. The ItemRenderer still needs to know the value of the data otherwise it will be treated like an empty row in the DataGrid.
</p>
<p>
<strong>Swap ItemRenderer Images Based on Data </strong><br />
As a nice UI feature let&#8217;s display a male/female icon based on the person&#8217;s gender. This is easy to do, we know the data will be a Person VO. So we can have the Image component ask for the correct image based on the &#8216;person.gender&#8217; value:
</p>
<pre>
&lt;mx:Image id="gender_img" source="{getGenderImg(person.gender)}"...
</pre>
<p>
Since the person variable is Bindable if there is a change the &#8216;getGenderImg&#8217; function will be asked to give the image its source:
</p>
<pre>
private function getGenderImg(gender:String):Class {
	if (gender == Person.GENDER_FEMALE) {
		return imgUserFemale;
	} else {
		return imgUserMale;
	}
}
</pre>
<p>
<strong>Highlight Selected ItemRenderer</strong><br />
Next let&#8217;s add some nice functionality to make the ItemRenderer stand out a little more when it is selected. To do this we need to override another function.  This time we&#8217;re going to override the updateDisplayList function, this will allow us to set some styles and graphical elements to the ItemRenderer is if is the selected itemRenderer. Using &#8216;ListBase&#8217; we are able to find out if the &#8216;owner&#8217; (the DataGrid) has this data selected:
</p>
<pre>
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
	super.updateDisplayList(unscaledWidth, unscaledHeight);
	if(ListBase(owner).isItemSelected(data)) {
		name_lbl.setStyle("styleName","pnameselected");
		selected_img.visible = true;
	} else {
		name_lbl.setStyle("styleName","pname");
		selected_img.visible = false;
	}
}
</pre>
<p>
<strong>Enable ItemRenderer to dispatch a remove person event</strong><br />
Lastly we&#8217;d like the trash can icon to remove a the person when clicked. There are other (maybe more preferable, but that&#8217;s for a different example) methods, but for this example let&#8217;s have the ItemRenderer dispatch an event and have a listener set to catch that event. On the click event of the trash can icon there is an event dispatched:
</p>
<pre>
public static const DELETE_PERSON_EVENT:String = "deletePerson";
private function deleteClick_handler():void {
	var dEvt:Event = new Event(DELETE_PERSON_EVENT,true);
	this.dispatchEvent(dEvt);
}
</pre>
<p>
This &#8216;deletePerson&#8217; event is dispatched by the ItemRenderer and importantly has &#8216;bubbles&#8217; set to true. This bubbling enables the parent component to simply add a listener for the event:
</p>
<pre>
myDG.addEventListener(PersonItemRenderer.DELETE_PERSON_EVENT,deletePerson_handler);
private function deletePerson_handler(evt:Event):void {
	if (myDG.selectedIndex != -1)
		peopleDataProvider.removeItemAt(myDG.selectedIndex);
}
</pre>
<p>
That&#8217;s it for this example. The next example will build on this but go the route of a dynamic ItemRenderer, while they a little bit more complicated can be very flexible allowing for dynamic properties to be set on the itemRenderers.<br />
<br />
<a href="http://www.leavethatthingalone.com/examples/flex/itemrenderer01" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.leavethatthingalone.com');" target="_blank"><strong>View the Example</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/09/15/example-of-feature-rich-itemrenderers-in-flex/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using ServiceCapture and Fiddler with FireFox</title>
		<link>http://www.themorphicgroup.com/blog/2008/09/05/using-servicecapture-and-fiddler-with-firefox/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/09/05/using-servicecapture-and-fiddler-with-firefox/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 04:40:22 +0000</pubDate>
		<dc:creator>Sam Ahn</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=44</guid>
		<description><![CDATA[I&#8217;ve been using both ServiceCapture and Fiddler for a while now to debug HTTP traffic from web applications (I&#8217;ve dabbled with TamperData but never got hooked). Using such software with FireFox was a bit cumbersome due to the network settings you have to turn on and off. That is until I stumbled across the ConnSets [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using both <a href="http://kevinlangdon.com/serviceCapture/" onclick="javascript:pageTracker._trackPageview('/outbound/article/kevinlangdon.com');">ServiceCapture</a> and <a href="http://www.fiddlertool.com/fiddler/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.fiddlertool.com');">Fiddler</a> for a while now to debug HTTP traffic from web applications (I&#8217;ve dabbled with TamperData but never got hooked). Using such software with FireFox was a bit cumbersome due to the network settings you have to turn on and off. That is until I stumbled across the <a href="https://addons.mozilla.org/en-US/firefox/addon/3452" onclick="javascript:pageTracker._trackPageview('/outbound/article/addons.mozilla.org');">ConnSets</a> plugin.</p>
<p>ConnSets lets you save network settings configurations and switch from one to another with a click of a menu option. Here are some tips for working with ConnSets:</p>
<h3><strong>Create a Default Setting</strong></h3>
<p>After installing ConnSets, you get the default option &#8220;none - Standard&#8221; as shown in this screenshot:</p>
<p><a href="http://www.themorphicgroup.com/blog/wp-content/uploads/2008/09/connsets1.jpg" ><img class="alignnone size-medium wp-image-42" title="none - Standard" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2008/09/connsets1-300x204.jpg" alt="" width="300" height="204" /></a></p>
<p>Selecting &#8220;none - Standard&#8221; essentially turns off ConnSets. If you&#8217;ve changed your network settings and then choose &#8220;none - Standard&#8221; it does not reset your settings to the default &#8220;Direct connection to the Internet&#8221;. Create a default setting and use that instead of &#8220;none - Standard&#8221;.</p>
<ol>
<li>Go to: Tools &gt; Options &gt; Advanced &gt; Network</li>
<li style="text-align: left;">Select &#8220;Direct connection to the Internet:&#8221;</li>
<li style="text-align: left;">Click OK to close out of Connection Settings</li>
<li style="text-align: left;">Click OK to close out of Options</li>
<li style="text-align: left;">Go to: Tools &gt; ConnSets &gt; Store</li>
<li style="text-align: left;">Enter &#8220;default&#8221; for the key in the dialog and click OK</li>
<li style="text-align: left;">Enter any value for the location (default = &#8220;Location&#8221;) in the dialog and click OK</li>
</ol>
<p>You should now see the default option as in this screenshot:</p>
<p><a href="http://www.themorphicgroup.com/blog/wp-content/uploads/2008/09/connsets2.jpg" ><img class="alignnone size-medium wp-image-43" title="default" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2008/09/connsets2-300x209.jpg" alt="" width="300" height="209" /></a></p>
<h3><strong>Using ConnSets with ServiceCapture</strong></h3>
<ol>
<li>Install ServiceCapture</li>
<li>Go to: Tools &gt; Options &gt; Advanced &gt; Network</li>
<li style="text-align: left;">Select &#8220;Automatic proxy configuration URL:&#8221;</li>
<li style="text-align: left;">Enter &#8220;file:///C:/Program%20Files/ServiceCapture/firefox.js&#8221;</li>
<li style="text-align: left;">Click OK to close out of Connection Settings</li>
<li style="text-align: left;">Click OK to close out of Options</li>
<li style="text-align: left;">Go to: Tools &gt; ConnSets &gt; Store</li>
<li style="text-align: left;">Enter &#8220;ServiceCapture&#8221; for the key in the dialog and click OK</li>
<li style="text-align: left;">Enter a value for the location (default = &#8220;Location&#8221;) in the dialog and click OK</li>
</ol>
<p>You should now see the ServiceCapture option as in this screenshot:</p>
<p><a href="http://www.themorphicgroup.com/blog/wp-content/uploads/2008/09/connsets3.jpg" ><img class="alignnone size-medium wp-image-48" title="ServiceCapture" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2008/09/connsets3-300x204.jpg" alt="" width="300" height="204" /></a></p>
<p>To view FireFox traffic through ServiceCapture, Go to Tools &gt; ConnSets &gt; ServiceCapture - Location</p>
<p>To stop viewing FireFox traffic through ServiceCapture, Go to Tools &gt; ConnSets &gt; default - Location</p>
<h3><strong>Using ConnSets with Fiddler</strong></h3>
<ol>
<li>Install Fiddler</li>
<li>Go to: Tools &gt; Options &gt; Advanced &gt; Network</li>
<li style="text-align: left;">Select &#8220;Manual proxy configuration URL:&#8221;</li>
<li style="text-align: left;">Enter 127.0.0.1 for HTTP Proxy</li>
<li style="text-align: left;">Enter 8888 for Port</li>
<li style="text-align: left;">Click OK to close out of Connection Settings</li>
<li style="text-align: left;">Click OK to close out of Options</li>
<li style="text-align: left;">Go to: Tools &gt; ConnSets &gt; Store</li>
<li style="text-align: left;">Enter &#8220;Fiddler&#8221; for the key in the dialog and click OK</li>
<li style="text-align: left;">Enter a value for the location (default = &#8220;Location&#8221;) in the dialog and click OK</li>
</ol>
<p>You should now see the Fiddler option as in this screenshot:</p>
<p><a href="http://www.themorphicgroup.com/blog/wp-content/uploads/2008/09/connsets4.jpg" ><img class="alignnone size-medium wp-image-49" title="Fiddler" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2008/09/connsets4-300x213.jpg" alt="" width="300" height="213" /></a></p>
<p>To view FireFox traffic through Fiddler, Go to Tools &gt; ConnSets &gt; Fiddler - Location</p>
<p>To stop viewing FireFox traffic through Fiddler, Go to Tools &gt; ConnSets &gt; default - Location</p>
<h3><strong>Save Yourself a Click</strong></h3>
<p>You can add a ConnSets button to your Toolbar to save yourself a valuable:</p>
<ol>
<li>Go to: View &gt; Toolbars &gt; Customize</li>
<li>Find the ConnSets button</li>
<li>Drag it to your Toolbar</li>
</ol>
<p>I use the Icons view and added the ConnSets button right next to my address bar as in this screenshot:</p>
<p><a href="http://www.themorphicgroup.com/blog/wp-content/uploads/2008/09/connsets5.jpg" ><img class="alignnone size-medium wp-image-50" title="Toobar Button" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2008/09/connsets5-300x250.jpg" alt="" width="300" height="250" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/09/05/using-servicecapture-and-fiddler-with-firefox/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SVN hidden files affecting Flash CS3 publishing</title>
		<link>http://www.themorphicgroup.com/blog/2008/08/05/svn-hidden-files-affecting-flash-cs3-publishing/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/08/05/svn-hidden-files-affecting-flash-cs3-publishing/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 02:47:42 +0000</pubDate>
		<dc:creator>Sam Ahn</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=40</guid>
		<description><![CDATA[It appears that SVN hidden files can affect Flash CS3 publishing. A couple other developers and I came across an issue when trying to publish an .fla. We&#8217;re all on Window XP and the files are in SVN. One day Flash started showing errors when publishing such as:

1046: Type was not found or was not [...]]]></description>
			<content:encoded><![CDATA[<p>It appears that SVN hidden files can affect Flash CS3 publishing. A couple other developers and I came across an issue when trying to publish an .fla. We&#8217;re all on Window XP and the files are in SVN. One day Flash started showing errors when publishing such as:</p>
<ul>
<li>1046: Type was not found or was not a compile-time constant: [class with static consts].</li>
<li>5001: The name of package &#8216;[class package]&#8216; does not reflect the location of this file. Please change the package definition&#8217;s name inside this file, or move the file. [class pointing to library symbol]</li>
</ul>
<p>Of course we couldn&#8217;t find any issues with the code or .fla. After much trial and error it was discovered that if you exported the source files (thus removing all SVN hidden files) it published without any errors. After even more trial and error, it was discovered that there is some threshold of files in SVN that when exceeded causes those mysterious errors (<a href="http://agit8.turbulent.ca/bwp/2008/05/01/flash-cs3-bug-on-mac-os-x-and-subversion-svn-files/" onclick="javascript:pageTracker._trackPageview('/outbound/article/agit8.turbulent.ca');">this related post</a> tipped me off.). In one project there were roughly 200 class files and the mysterious errors appeared. After running SVN cleanup (which removes temporary hidden SVN files), the errors went away. This unfortunately didn&#8217;t help in another larger project. As a work-around we can publish on exported files.</p>
<p>What bothers me is that Flash CS3 publishing is affected by files it&#8217;s not told to look for. Could it be related to the fact that SVN hidden files include copies of the versioned files (e.g. .svn/text-base/MyClass.as.svn-base)? </p>
<p>I&#8217;m not surprised that I couldn&#8217;t find much information on this bug because most people who version control larger Flash projects are likely using Flex Builder.</p>
<p>I&#8217;ve submitted a bug to Adobe but hope there&#8217;s a more direct solution. Is anyone else having such an issue? Does anyone have any insight into how Flash CS3 publishes or how SVN hidden files affect other applications?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/08/05/svn-hidden-files-affecting-flash-cs3-publishing/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Morphic Group Helps Build PermissionTV PDK</title>
		<link>http://www.themorphicgroup.com/blog/2008/07/30/the-morphic-group-helps-build-permissiontv-pdk/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/07/30/the-morphic-group-helps-build-permissiontv-pdk/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 15:11:27 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=39</guid>
		<description><![CDATA[The Morphic Group has been working with PermissionTV since 2007, lending our engineering expertise to the architecture and development of the next generation of the PermissionTV platform. Specifically we&#8217;ve been working with them on the Platform Development Kit (PDK), which contains a large set of libraries and an application architecture designed for the express purpose [...]]]></description>
			<content:encoded><![CDATA[<p>The Morphic Group has been working with PermissionTV since 2007, lending our engineering expertise to the architecture and development of the next generation of the PermissionTV platform. Specifically we&#8217;ve been working with them on the Platform Development Kit (PDK), which contains a large set of libraries and an application architecture designed for the express purpose of building highly flexible video applications for the PermissionTV platform using Flash and/or Flex. PermissionTV just announced the official launch of the PDK, and now we get to talk about the work we&#8217;ve been doing. This is good news for us because now we can finally start to disclose details of what we&#8217;ve been working on in silence for months and months.</p>
<p>We think the PDK is one of the coolest projects we&#8217;ve seen in a long time. We really like PermissionTV, and we think they&#8217;ve got a real edge over their competitors because they are willing to innovate in ways that others simply aren&#8217;t. Working with PermissionTV is a genuinely great experience. They seem to &#8220;get it&#8221; when it comes to the marketplace, and (for us) more importantly, when it comes to engineering. The PDK shows this, I think. Unlike many of their competitors PermissionTV&#8217;s PDK is a well-documented and well-engineered (which should go without saying since we had a hand in building it) complete (yet extensible) solution for building video applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/07/30/the-morphic-group-helps-build-permissiontv-pdk/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dynamically Getting JavaScript Properties</title>
		<link>http://www.themorphicgroup.com/blog/2008/07/23/dynamically-getting-javascript-properties/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/07/23/dynamically-getting-javascript-properties/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 03:44:35 +0000</pubDate>
		<dc:creator>Sam Ahn</dc:creator>
		
		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=38</guid>
		<description><![CDATA[Jumping off of Joey&#8217;s post about anonymous functions from externalinterface, here&#8217;s a quick and perhaps obvious method of dynamically getting JavaScript properties:


package examples {

import flash.external.ExternalInterface;

public class JavaScript {

    public static function getProperty(name:String):Object {
        var property:Object;
        if (ExternalInterface.available) {
 [...]]]></description>
			<content:encoded><![CDATA[<p>Jumping off of Joey&#8217;s post about <a href="http://www.themorphicgroup.com/blog/2008/06/05/anonymous-functions-from-externalinterface/" >anonymous functions from externalinterface</a>, here&#8217;s a quick and perhaps obvious method of dynamically getting JavaScript properties:</p>
<pre>
<code>
package examples {

import flash.external.ExternalInterface;

public class JavaScript {

    public static function getProperty(name:String):Object {
        var property:Object;
        if (ExternalInterface.available) {
            property = ExternalInterface.call("function() { return " + name +"; }");
        } else {
            property = new Object()
        }
        return property;
    }

    public function JavaScript() {}
}
}
</code>
</pre>
<p>The getProperty() method creates a dynamic anonymous function that simply returns a value.<br />
With such a utility, you can easily access JavaScript properties like so:</p>
<pre>
<code>
trace(JavaScript.getProperty("window.location.href"));
</code>
</pre>
<p>Who needs the FABridge? Just kidding&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/07/23/dynamically-getting-javascript-properties/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex Link Buttons: Adding line breaks/wordwrap functionality</title>
		<link>http://www.themorphicgroup.com/blog/2008/07/23/flex-link-buttons-adding-line-breakswordwrap-functionality/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/07/23/flex-link-buttons-adding-line-breakswordwrap-functionality/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 21:05:40 +0000</pubDate>
		<dc:creator>Dennis</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=37</guid>
		<description><![CDATA[In my endless pursuit to rely more on the flex framework instead of created components from the ground up (call it a outset of flash-itis),  I still find cases where I need to refine flex components. For example, Link buttons. How do you add line breaks and word wrapping in a link button? After [...]]]></description>
			<content:encoded><![CDATA[<p>In my endless pursuit to rely more on the flex framework instead of created components from the ground up (call it a outset of flash-itis),  I still find cases where I need to refine flex components. For example, Link buttons. How do you add line breaks and word wrapping in a link button? After a bit of searching &#8230; I found this simple solution that I would like to share.</p>
<p>You would essential extend the linkButton class by creating your own custom linkButton. This custom component would override createChildren and measureText methods. In createChildren(), you would enable &#8220;textField&#8221; to workwrap and allow multiple lines. Then in measureText(), the correct height and width needs to be set by getting line metrics of the &#8220;textField&#8221;. </p>
<p>Note: &#8220;textField&#8221; is a Text Field property in the base class.</p>
<pre><code>
...
override protected function createChildren():void
{
     super.createChildren();
     if (textField){
         textField.wordWrap = true;
         textField.multiline = true;
     }
}

override public function measureText(s:String):TextLineMetrics
{
     textField.text = s;
     var lineMetrics:TextLineMetrics = textField.getLineMetrics(0);
     lineMetrics.width = textField.textWidth;
     lineMetrics.height = textField.textHeight;

     return lineMetrics;
}
...
</pre>
<p></code></p>
<p>It is important to set the width within your custom tag. For the best results, you should set the height though it is not necessary.</p>
<p>Please let me know if you have a better workaround or any comments on other extensions of Flex components.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/07/23/flex-link-buttons-adding-line-breakswordwrap-functionality/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Morphic Group: Adobe Solution Partner</title>
		<link>http://www.themorphicgroup.com/blog/2008/07/02/the-morphic-group-adobe-solution-partner/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/07/02/the-morphic-group-adobe-solution-partner/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 22:35:51 +0000</pubDate>
		<dc:creator>Sam Roach</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=34</guid>
		<description><![CDATA[The Morphic Group is proud to announce its participation in the Adobe Solution Partner Program. This strategic alliance is a conscious effort to demonstrate the company&#8217;s dedication to its customers by leveraging access to Adobe&#8217;s developer core, as well as strengthen The Morphic Group’s brand in the RIA community.
The Adobe Solution Partner Program benefits partners [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">The Morphic Group is proud to announce its participation in the Adobe Solution Partner Program. This strategic alliance is a conscious effort to demonstrate the company&#8217;s dedication to its customers by leveraging access to Adobe&#8217;s developer core, as well as strengthen The Morphic Group’s brand in the RIA community.</p>
<p>The Adobe Solution Partner Program benefits partners who extend, enhance and support Adobe products and technologies in the solutions they deliver to customers. As a member, The Morphic Group recognized the additional benefits and opportunities Adobe&#8217;s program provides. And by integrating new technologies into their products, The Morphic Group is able to extend their reach as well as provide superior support.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/07/02/the-morphic-group-adobe-solution-partner/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LineLimitText Component: Text With maxLines Property</title>
		<link>http://www.themorphicgroup.com/blog/2008/06/17/linelimittext-component-text-with-maxlines-property/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/06/17/linelimittext-component-text-with-maxlines-property/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 20:46:48 +0000</pubDate>
		<dc:creator>Sam Ahn</dc:creator>
		
		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=11</guid>
		<description><![CDATA[A little while ago I worked on a project that required some Flex screens to have text fields display dynamic text using a specified maximum number of lines. A simple solution would be to merely define a height on a Text component. In this case there were other components that flowed in the layout below [...]]]></description>
			<content:encoded><![CDATA[<p>A little while ago I worked on a project that required some Flex screens to have text fields display dynamic text using a specified maximum number of lines. A simple solution would be to merely define a height on a Text component. In this case there were other components that flowed in the layout below the text field. Setting a height would show an unnecessary space for text that had fewer than the maximum number of lines. Also setting a height wouldn&#8217;t work well with changing the text styles.</p>
<p>So what was I to do? After reading the Flex docs and scanning the Text, Label, and TextField source, I decided to subclass the Text component. Here is the resulting component:</p>
<pre><code>
package com.themorphicgroup.controls {

   import flash.text.TextLineMetrics;

   import mx.core.mx_internal;
   import mx.core.UITextField;
   import mx.controls.Text;

   use namespace mx_internal;

   public class LineLimitText extends Text {

       protected var _maxLines:uint = 0; // max lines to show; 0 = do nothing;
       private var _isTruncated:Boolean = false;
      private var explicitHTMLText:String = null; 

      public function get maxLines():uint {
         return _maxLines;
      }

      public function set maxLines(value:uint):void {
         if (_maxLines != value) {
            _maxLines = value;
            invalidateDisplayList();
            invalidateSize();
         }
      }

      /**
       * Returns the number of lines displayed.
       */
      public function get numLines():int {
         var lines:int;

         if (_maxLines &gt; 0) {
            var metrics:TextLineMetrics = textField.getLineMetrics(0);
            var textHeight:Number = Math.ceil(metrics.height) * _maxLines;
            if (textField.height &gt; textHeight) {
               lines = _maxLines;
            } else {
               lines = textField.numLines;
            }
         } else {
            lines = textField.numLines;
         }
         return lines;
      }

      override public function set text(value:String):void {
         super.text = value;
         explicitHTMLText = null;
      }

       override public function set htmlText(value:String):void {
          super.htmlText = value;
          explicitHTMLText = value;
       }

      /**
       * Overriding measure and trucating the lines here.
       * If not HTML and is truncated, add ellipses.
       */
      override protected function measure():void {
         super.measure();

         // if not html
         if (!isHTML) {
            // if previously truncated, reset the text to the original
            if (_isTruncated) {
               textField.text = super.text;
               textField.validateNow();
            }
         }         

         // if want to limit lines
         if ((_maxLines &gt; 0) &amp;&amp; (textField.numLines &gt; _maxLines)) {
            // if not html
            if (!isHTML) {
               _isTruncated = true;

               var newText:String = "";
               var line:String;
               // loop through lines and collect text
               for (var i:uint = 0; i &lt; _maxLines; i++) {
                  line = textField.getLineText(i);
                  if (i &lt; (_maxLines - 1)) {
                     newText += line;
                  // if on last line
                  } else {
                     // remove end and add ...'s
                     line = line.substr(0, line.length - 3);         // cut 3 chars off end
                     line = line.substr(0, line.lastIndexOf(" "));   // cut at last space
                     newText += (line + "...");
                  }
               }
            }

            // calc and set the measured height
            var metrics:TextLineMetrics = textField.getLineMetrics(0);
            var newTextHeight:Number = Math.ceil(metrics.height) * _maxLines;
            measuredHeight = newTextHeight + UITextField.TEXT_HEIGHT_PADDING;

            // if not html
            if (!isHTML) {
               textField.text = newText;
            }
         } else {
            // if not html
            if (!isHTML) {
               // if truncated before, but dont need it anymore, reset size
               if (_isTruncated) {
                  textField.autoSize = "left";
                  measuredHeight = textField.textHeight + UITextField.TEXT_HEIGHT_PADDING;
               }
               _isTruncated = false;
            }
         }
      }

       private function get isHTML():Boolean {
         return explicitHTMLText != null;
      }
   }
}
</code></pre>
<p>The key to this component was overriding the protected measure() method and accessing the protected textField variable. The measure() method uses the new maxLines property and limits the number of lines in the textField if necessary. Now this new measure() method is more expensive so I wouldn&#8217;t go and use it everywhere.</p>
<p>Here is an example application that uses LineLimitText:</p>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:controls="com.themorphicgroup.controls.*" layout="absolute"&gt;
   &lt;mx:Script&gt;
      &lt;![CDATA[
         [Bindable]
         private var _lipsum:String = &#8220;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam et mi. Sed mi. In sit amet tortor. Curabitur eget neque. Ut nisi quam, convallis eget, elementum at, condimentum vitae, lorem. Vestibulum adipiscing hendrerit ligula. Donec vitae dolor id libero ultricies condimentum. Nulla dapibus sapien. Aliquam consectetuer lacus non nisl. Suspendisse rutrum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.&#8221;;
      ]]&gt;
   &lt;/mx:Script&gt;
   &lt;mx:Style&gt;
      FormItem {
         backgroundColor: #FFFFFF;
      }
   &lt;/mx:Style&gt;
   &lt;mx:Form&gt;
      &lt;mx:FormItem label=&#8221;mx:Label, width=200&#8243;&gt;
         &lt;mx:Label text=&#8221;{_lipsum}&#8221; width=&#8221;200&#8243;/&gt;
      &lt;/mx:FormItem&gt;
      &lt;mx:FormItem label=&#8221;mx:Text, width=200&#8243;&gt;
         &lt;mx:Text text=&#8221;{_lipsum}&#8221; width=&#8221;200&#8243;/&gt;
      &lt;/mx:FormItem&gt;
      &lt;mx:FormItem label=&#8221;mx:Text, width=200, height=60&#8243;&gt;
         &lt;mx:Text text=&#8221;{_lipsum}&#8221; width=&#8221;200&#8243; height=&#8221;60&#8243;/&gt;
      &lt;/mx:FormItem&gt;
      &lt;mx:FormItem label=&#8221;controls:LineLimitText, width=200&#8243;&gt;
         &lt;controls:LineLimitText text=&#8221;{_lipsum}&#8221; maxLines=&#8221;4&#8243; width=&#8221;200&#8243; color=&#8221;#FF0000&#8243;/&gt;
      &lt;/mx:FormItem&gt;
   &lt;/mx:Form&gt;
&lt;/mx:Application&gt;
</pre>
<p>This results in the following screenshot:</p>
<p><img class="alignnone size-full wp-image-28" title="linelimittextexample" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2008/06/linelimittextexample.jpg" alt="" width="423" height="386" /></p>
<p>The text in red in the screenshot uses LineLimitText. Also in the screenshot is a Text component with a defined height. That one doesn&#8217;t have the fancy ellipses though. This component was an interesting exercise in understanding Flex components, reading docs and source.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/06/17/linelimittext-component-text-with-maxlines-property/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Better Unit Tests With FlexUnit</title>
		<link>http://www.themorphicgroup.com/blog/2008/06/17/better-unit-tests-with-flexunit/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/06/17/better-unit-tests-with-flexunit/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 12:55:11 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
		
		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=27</guid>
		<description><![CDATA[This is probably not news. In fact, it&#8217;s definitely not _new_ news on account of I learned about it from Theo Hultberg&#8217;s blog from a post from last year (http://blog.iconara.net/2007/02/06/flexunit/). However, it was, rather embarassingly, news to me, and therefore I&#8217;ll post it just in case someone else doesn&#8217;t know this. You can write unit [...]]]></description>
			<content:encoded><![CDATA[<p>This is probably not news. In fact, it&#8217;s definitely not _new_ news on account of I learned about it from Theo Hultberg&#8217;s blog from a post from last year (http://blog.iconara.net/2007/02/06/flexunit/). However, it was, rather embarassingly, news to me, and therefore I&#8217;ll post it just in case someone else doesn&#8217;t know this. You can write unit tests with FlexUnit using what is probably a more familiar structure to most people than the structure promoted by the FlexUnit documentation.</p>
<p>I&#8217;ve been using FlexUnit for a few years. And during this time I naively thought you _had_ to write tests using the structure that Darron Schall wrote about (http://www.darronschall.com/weblog/archives/000216.cfm). However, I never really cared much for that structure. I found it strange, and it didn&#8217;t provide the flexibility I wanted in unit tests. For client work I just accepted this. However, recently I started writing a new chapter for the pending Programming Flex 3, and I decided to mention unit tests with FlexUnit. It was at that point that I thought &#8220;there must be a better way to write these tests.&#8221; It was only then that I ran a Google search and read Theo&#8217;s blog post.</p>
<p>Although Theo&#8217;s blog post describes how you can alternately write FlexUnit tests I&#8217;ll summarize with examples as well.</p>
<p>Basically, the popular FlexUnit approach is to use a static method that returns a TestSuite for every test, and the test&#8217;s constructor accepts a string parameter naming the test method to run. This is the approach that Darron writes about. It&#8217;s an approach that was unfamiliar to me until working with FlexUnit. My previous experience with unit testing was purely via the (excellent) book Test Driven Development By Example, and in that book the tests are structured differently. Theo describes how to structure tests in that way. That way requires that the test constructor does not require a parameter, and instead the test runner will run all methods on the test class where the method names start with &#8220;test&#8221;. I&#8217;ll show a simple example.<br />
Consider the following, very complex and useful class that you need to test.</p>
<pre><code>
package {
	public class Adder {

		public function Adder() {
		}

		public function add(a:Number, b:Number):Number {
			return a + b;
		}

	}
}
</code></pre>
<p>The following shows a simple example test case class. This class defines three test methods, which is clear because the method names start with &#8220;test&#8221;.</p>
<pre><code>
package {
	import flexunit.framework.TestCase;

	public class AdderTest extends TestCase {

		public function AdderTest() {
			super();
		}

		public function testPositiveInts():void {
			var adder:Adder = new Adder();
			assertEquals(adder.add(5, 4), 9);
		}

		public function testNegativeInts():void {
			var adder:Adder = new Adder();
			assertEquals(adder.add(-5, -4), -9);
		}

		public function testNaN():void {
			var adder:Adder = new Adder();
			assertTrue(isNaN(adder.add(5, NaN)));
		}

	}
}
</code></pre>
<p>The test runner looks like the following.</p>
<pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="creationCompleteHandler();" xmlns:flexui="flexunit.flexui.*"&gt;
	&lt;mx:Script&gt;
		&lt;![CDATA[
			import flexunit.framework.TestSuite;

			private function creationCompleteHandler():void {
				var suite:TestSuite = new TestSuite();
				suite.addTestSuite(AdderTest);
				testRunner.test = suite;
				testRunner.startTest();
			}

		]]&gt;
	&lt;/mx:Script&gt;
	&lt;flexui:TestRunnerBase id=&#8221;testRunner&#8221; width=&#8221;100%&#8221; height=&#8221;100%&#8221; /&gt;
&lt;/mx:Application&gt;
<code>

</code></pre>
<p>Note that we use addTestSuite() to add a reference to the test case class to the test runner. This will automatically run all the methods starting with &#8220;test&#8221;.<br />
Apart from the simplicity and clarity of this way of structuring tests you also get to use setUp() and tearDown(), which automatically run before and after every test method. The following is another example illustrating setUp() and tearDown(). This time we&#8217;ll use a sort-of VO class called Example that has a static method for creating a new Example object from XML data.</p>
<pre><code>
package {
	public class Example {

		private var _a:String;
		private var _b:String;

		public function get a():String {
			return _a;
		}

		public function set a(value:String):void {
			_a = value;
		}

		public function get b():String {
			return _b;
		}

		public function set b(value:String):void {
			_b = value;
		}		

		public function Example() {
		}

		static public function parseFromXml(xml:XML):Example {
			var example:Example = new Example();
			example.a = xml.a.toString();
			example.b = xml.b.toString();
			return example;
		}

	}
}
</code></pre>
<p>The test for this looks like the following.</p>
<pre><code>
package {
	import flexunit.framework.TestCase;

	public class ExampleTest extends TestCase {

		private var _example:Example;

		public function ExampleTest() {
			super();
		}

		override public function setUp():void {
			_example = Example.parseFromXml(<a>Value 1</a><strong>Value 2</strong>);
		}

		override public function tearDown():void {
			_example = null;
		}

		public function testA():void {
			assertEquals(_example.a, &#8220;Value 1&#8243;);
		}

		public function testB():void {
			assertEquals(_example.b, &#8220;Value 2&#8243;);
		}

	}
}
</code></pre>
<p>Notice that both setUp() and tearDown() are overridden.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/06/17/better-unit-tests-with-flexunit/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash Video: The Best of Both Worlds (or how I learned to love Cue Points)</title>
		<link>http://www.themorphicgroup.com/blog/2008/06/11/flash-video-the-best-of-both-worlds-or-how-i-learned-to-love-cue-points/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/06/11/flash-video-the-best-of-both-worlds-or-how-i-learned-to-love-cue-points/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 18:21:25 +0000</pubDate>
		<dc:creator>Dennis</dc:creator>
		
		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=26</guid>
		<description><![CDATA[Video is the word. It is now used every capacity on the net. The idea of using video with animation is not new. Some would swear by using After Effects solely and not consider building flash timeline animation with video. In some case, you use what you know. And at The Morphic Group, we know [...]]]></description>
			<content:encoded><![CDATA[<p>Video is the word. It is now used every capacity on the net. The idea of using video with animation is not new. Some would swear by using After Effects solely and not consider building flash timeline animation with video. In some case, you use what you know. And at The Morphic Group, we know Flash and Actionscript.</p>
<p>We were asked to build a presentation that featured video of a person talking about the client’s product while presenting statistic and data in an exciting visual way. We decided to do this presentation with Flash Timeline animation, Actionscript, FLV video files and some luck. The idea was to get a production house to produce video excerpts with alpha layers. A script was conceived and the video assets were delivered within a few weeks to a month (give or take the corrections and post-production snafus). While we were waiting for the video to arrive, I built the shell application that would house the video sections (SWF files with external video). Each section would contain the various video takes in the order of the production script. You never know how a script like this will play until you actually build the different sections. This was definitely the case for this project.</p>
<p>For me…. The developer… I wanted to control everything to the nth degree. The shell loads all of the video sections (swfs), animates the transition moving from one section to another via script, and has a navigation link bar with a drop down menu, all the things we do best in the programming structured discipline. But for the video sections themselves, it is a different story. I needed to consider the best environment for the animator/designer to work freely, to give them enough space for their animations and somehow gel the programming and video together.</p>
<p>That is where cue points come in (and save the day). The designer/animator created a list of titles for the animation in order of the video script. We developed a system where the cue point names would be the frame titles for the main movie clip; which would house the animations. I embedded cue points into the video to then play animation content at different instances of the presentation. This planning and collaborating was done well before any flash production started.</p>
<p>Example event handler for the cue points from the FLVPlayback (videoPlayer)<br />
….<br />
videoPlayer.addEventListener(&#8221;cuePoint&#8221;, onCuePointHandler);<br />
….</p>
<p>function onCuePointHandler(event:MetadataEvent){</p>
<p>var cuePointName:String = event.info.name;<br />
mainAnimation.gotoAndStop(cuePointName);<br />
}</p>
<p>This is not a perfect system by any means. Most developer would poo poo the notion of using FLVPlayback, instead creating a video player class and going the route of a fully Actionscript solution. But I needed to keep in mind that the animator/designer would be using the timeline as his tool. We needed to see everything on the timeline. Animators/designers who work with the timeline seem to come up with amazing yet manageable animations that could never be created via script. Besides, it is a visual medium after all.</p>
<p>After creating one video section, we began to developer an organic workflow with the other sections. I built the FLAs with the cue point embedded video and code for referencing frame sections (named by the animation names). The designer/Animator added animations within the empty frame sections that are called based on the cue points fired. We had a system and we stuck to it throughout the project. The results were easy to see. The process of removing and moving parts that did not work was simple.</p>
<p>It is true that nothing is ever written in stone when you create a presentation like this.  Here is an example of this fact. When we tested pieces of the presentation on the web, we noticed a big problem. The video did not always synch up with animation. Keep in mind that most of the animations consisted of movie clips embedded within movie clips. The solution was to create additional cue points, directly fire (or play) beginning/ending animations when needed and remove unnecessary frames. This improved the performance greatly and solved the lag problem on the web.</p>
<p>I will be honest with you. This approach is a bit wacky. In fact, I would revise the process if another projects like this comes up again. It got the job done and it did not break the original plan and system. As long as you keep things consistent and have a plan, you will always find a way out of any jam.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/06/11/flash-video-the-best-of-both-worlds-or-how-i-learned-to-love-cue-points/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Anonymous Functions From ExternalInterface</title>
		<link>http://www.themorphicgroup.com/blog/2008/06/05/anonymous-functions-from-externalinterface/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/06/05/anonymous-functions-from-externalinterface/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 14:49:05 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
		
		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=25</guid>
		<description><![CDATA[I&#8217;ve been working on an ActionScript library for a project. One of the recent and new requirements for this library is that it has to interface with a JavaScript API for a browser plugin. The JavaScript API for this particular plugin requires constructing instances of JavaScript objects, maintaining persistent references to those objects, calling methods [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on an ActionScript library for a project. One of the recent and new requirements for this library is that it has to interface with a JavaScript API for a browser plugin. The JavaScript API for this particular plugin requires constructing instances of JavaScript objects, maintaining persistent references to those objects, calling methods on those objects, creating divs, changing styles for divs and JavaScript objects, etc. Rather than create another set of JavaScript functions and require yet another &lt;script&gt; tag in the HTML page I figured it would be nicer to encapsulate everything into ActionScript.</p>
<p>Perhaps what I&#8217;m about to say is common knowledge and nothing of any interest to anyone. However, I thought it was interesting and worth posting about. The first parameter for the ExternalInterface.call() method is a string containing a name of a JavaScript function. When executed the call() method effectively appends the function call operator (the () ) to the function name and evaluates that expression. I hadn&#8217;t seen an example using an anonymous function definition in place of a function name, but I figured it might work, and it does. I figured this would work because in JavaScript you can do the following.</p>
<pre><code>
function() { alert('example'); }();
</code></pre>
<p>Notice the function call operator appended to the anonymous function. It causes the function to execute in JavaScript. Therefore, I figured that from ActionScript you could do the following.</p>
<pre><code>
ExternalInterface.call("function() { alert('example'); }");
</code></pre>
<p>That will work, which is neat. Not only that, but you can easily pass values from ActionScript to the JavaScript. The most obvious way to do that is as in the following example.</p>
<pre><code>
var message:String = "example";
ExternalInterface.call("function() { alert('" + message + "'); }");
</code></pre>
<p>However, you can also pass values as in the following example, which is a little nicer, in my opinion.</p>
<pre><code>
ExternalInterface.call("function(message) { alert(message); }", "example");
</code></pre>
<p>These examples are really simple to illustrate the point. However, you can also create much more complex functions. In fact, you can define functions that define functions, as in the following example.</p>
<pre><code>
var javascript:String = "function() { " +
                                    "timeoutHandler = function() { " +
                                        "alert('example', 2000); + "
                                    "};" +
                                    "setTimeout(timeoutHandler); }";
ExternalInterface.call(javascript);
</code></pre>
<p>In the library I wrote the functions configure event handlers for JavaScript events, and they use ExternalInterface callbacks to call ActionScript functions when the events are dispatched.</p>
<p>I guess this use of anonymous functions might not be the most efficient way to write or run JavaScript. It might even be bad memory management. I don&#8217;t claim to be a JavaScript expert. I just think it&#8217;s a neat use of ExternalInterface, and it has been very useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/06/05/anonymous-functions-from-externalinterface/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Unique Local Connection Names</title>
		<link>http://www.themorphicgroup.com/blog/2008/05/30/unique-local-connection-names/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/05/30/unique-local-connection-names/#comments</comments>
		<pubDate>Fri, 30 May 2008 15:06:13 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
		
		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[Adobe AIR]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=24</guid>
		<description><![CDATA[Occasionally I have the sense that I might be doing something as a workaround that is completely unnecessary, as though I&#8217;m jumping through hoops, listening for an exact sequence of one hundred events, and then squinting my eyes and tilting the monitor just right in order to assign text to a text field when I [...]]]></description>
			<content:encoded><![CDATA[<p>Occasionally I have the sense that I might be doing something as a workaround that is completely unnecessary, as though I&#8217;m jumping through hoops, listening for an exact sequence of one hundred events, and then squinting my eyes and tilting the monitor just right in order to assign text to a text field when I can achieve the same thing simply and directly with one line of code. All out of ignorance that there is a simpler way. This might be one of those occasions. If it is then it wouldn&#8217;t be the first.</p>
<p>In this case I had a requirement to create a unique name to use when connecting a LocalConnection. The idea is that two .swf files need to communicate over this LocalConnection, and both of them need to know the name of the connection. Seems simple enough. I could just hard code the same value into both .swf files. However, the deal is that these two .swf files exist in the same HTML page, and I also would like to be able to open more than one instance of the HTML page in different browser windows. If the name of the connection is hard coded into the .swf files then it will work for one instance of the page, but subsequent instances will throw errors because the connection will already be in use. In such cases the error might be something like the following (which is particularly unhelpful in diagnosing the actual error since it doesn&#8217;t really indicate what caused the error.)</p>
<p>Error #2044: Unhandled statusEvent:. level=error, code=</p>
<p>Note that you might see this error in other cases, and it doesn&#8217;t necessarily indicate that the solution described in this post is appropriate. This error could be caused by lots of different scenarios. For example, you would see this error if you were trying to send requests across domains and the .swf files weren&#8217;t properly configured (see allowDomain() in the LocalConnection documentation.) Probably the best way to determine the actual cause is to listen for status events on all LocalConnection object, and log the status codes. However, in this particular case the errors were because an .swf (in a new HTML window) was trying to establish a connection using the same name as a pre-existing connection.</p>
<p>One obvious solution to this would be to create a unique name using JavaScript, and then I can pass that in to each of the .swf files using FlashVars. That would allow each HTML page to create a unique name and pass in the same name to each of the .swf files, ensuring that those two .swf files can communicate over the same channel, but other .swf files in other pages wouldn&#8217;t conflict. That would work except that in this particular case one of the .swf files is not embedded directly in the HTML page, and it does not have access to the JavaScript in the HTML page. This is because one of the two .swf files is embedded inside another plugin that is, itself embedded in the HTML, and that plugin doesn&#8217;t have a way to pass a value from the HTML page to the Flash Player instance it embeds.</p>
<p>Therefore, the solution I&#8217;m using follows. Note that we&#8217;ll refer to the .swf files as sending.swf and receiving.swf. In this case sending.swf is the instance embedded in the HTML page directly, and receiving.swf is embedded in the plugin.</p>
<ol>
<li>Initially receiving.swf calls connect() for a LocalConnection object using a hard coded value of _defaultConnection.</li>
<li>Receiving.swf&#8217;s local connection client defines a method called setNewConnectionName(), which accepts a string parameter. When this method is called it first calls close() for the LocalConnection object, and then it calls connect(), using the parameter value.</li>
<li>Once both .swfs are loaded into their respective players sending.swf creates a new, unique connection name. You could use any algorithm to create a unique name. In this case I use the following: var connectionName:String = &#8220;_&#8221; + (new Date()).getTime();</li>
<li>Then sending.swf calls send(&#8221;_defaultConnection&#8221;, &#8220;setNewConnectionName&#8221;, connectionName); for the LocalConection object.</li>
<li>After that point sending.swf always calls send() with the new, unique connection name.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/05/30/unique-local-connection-names/feed/</wfw:commentRss>
		</item>
		<item>
		<title>West Coast Office Opens</title>
		<link>http://www.themorphicgroup.com/blog/2008/05/28/west-coast-office-opens/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/05/28/west-coast-office-opens/#comments</comments>
		<pubDate>Wed, 28 May 2008 17:50:50 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=23</guid>
		<description><![CDATA[This post is slightly belated, but that&#8217;s only because we&#8217;ve been super busy. The super part of the super busy is due to us opening a West coast office in Northern California. Jason Hanson and Seth Duffey just joined our forces to lead the new office. We&#8217;re very, very happy to have this opportunity to [...]]]></description>
			<content:encoded><![CDATA[<p>This post is slightly belated, but that&#8217;s only because we&#8217;ve been super busy. The super part of the super busy is due to us opening a West coast office in Northern California. Jason Hanson and Seth Duffey just joined our forces to lead the new office. We&#8217;re very, very happy to have this opportunity to work with such talented (and really great) people. You can read our fancy press release in <a title="the news room" href="http://www.themorphicgroup.com/newsroom/WestCoast.pdf" onclick="javascript:pageTracker._trackPageview('/downloads/newsroom/WestCoast.pdf');" target="_blank">the news room</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/05/28/west-coast-office-opens/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Flex 3 Deep Linking (BrowserManager) With SWFObject</title>
		<link>http://www.themorphicgroup.com/blog/2008/05/28/using-flex-3-deep-linking-browsermanager-with-swfobject/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/05/28/using-flex-3-deep-linking-browsermanager-with-swfobject/#comments</comments>
		<pubDate>Wed, 28 May 2008 15:59:56 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=22</guid>
		<description><![CDATA[Flex 3 has a great deep linking feature built right into the framework. I wasn&#8217;t actually expecting that it would even work at all much less work well, but it works extraordinarily well. This blog post isn&#8217;t about how to use the deep linking feature since the documentation is pretty good in that regard. You [...]]]></description>
			<content:encoded><![CDATA[<p>Flex 3 has a great deep linking feature built right into the framework. I wasn&#8217;t actually expecting that it would even work at all much less work well, but it works extraordinarily well. This blog post isn&#8217;t about how to use the deep linking feature since the documentation is pretty good in that regard. You can just search on Google for Flex 3 BrowserManager or look at the Adobe site or the Flex Help documentation for that. Instead, this post is about a topic that I was a little surprised wasn&#8217;t blogged elsewhere yet. The issue is how to use the deep linking feature with SWFObject.</p>
<p>Since SWFObject is the defacto standard for embedding Flex and Flash applications I find it odd, though not out of character for Adobe, that BrowserManager relies entirely on a very specific HTML template that ships with Flex. If you&#8217;ve ever looked at the Flex HTML templates then you know the code is&#8230;how to put this nicely&#8230;not what you&#8217;d want to put on your site. This is part of the reason SWFObject is the standard. Apart from the fact that SWFObject works really well, it also allows you to write really nice-looking, standards-compliant HTML code. We _always_ use SWFObject. We _never_ use the Flex HTML templates for production. The obvious dilemma then is how can we use the deep linking feature from Flex 3 AND use SWFObject if the deep linking feature is seemingly entirely dependent on a specific Flex HTML template?</p>
<blockquote><p><span style="color: #808080;">Note that for this post I&#8217;m only talking about SWFObject 2.0, and none of this is relevant to SWFObject 1.5 or earlier.</span></p></blockquote>
<p>The solution to this dilemma is not entirely great, but I think it&#8217;s better than having to use the Flex HTML template. I should add that there is a third-party deep linking solution called SWFAddress (<a title="www.asual.com/swfaddress" href="http://www.asual.com/swfaddress" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.asual.com');" target="_blank">www.asual.com/swfaddress</a>) that integrates well with SWFObject without any silly workarounds. However, since deep linking does work quite well with BrowserManager, and BrowserManager is built into the Flex 3 framework, I prefer to use the &#8220;official&#8221; solution in this case. (And yes, I know that it&#8217;s rather silly that I&#8217;m quick to throw out the &#8220;official&#8221; HTML solution but reticent to throw out BrowserManager.) The solution that I&#8217;ve found requires modifying the JavaScript file used by BrowserManager slightly. I&#8217;ll explain the few changes I made to get it to work.</p>
<blockquote><p><span style="color: #808080;">Note that these details are also outlined in the soon-to-be-published Programming Flex 3</span></p></blockquote>
<p>Basically the issue is that history.js, the JavaScript file used by BrowserManager (included in the Flex SDK) has a bit of lousy logic in how it finds the Flash Player instance for the Flex application. If you look at line 103 of the standard history.js file (in Flex Builder you&#8217;ll find this in the history subdirectory of the html-templates directory) you&#8217;ll see the getPlayer() method. This code assumes that the Flash Player is embedded using an &lt;embed&gt; tag nested in an &lt;object&gt; tag. It also assumes that you have only one .swf embedded in a page, or that you want to use history management/deep linking with the first .swf embedded in a page. These are bad assumptions. Even if you have only one .swf in the page this is still not going to work with SWFObject, which uses standards-compliant nested &lt;object&gt; tags. There are a handful of ways you could theoretically resolve this. The manner I use and that we&#8217;re using currently at The Morphic Group is to modify getPlayer() by adding the following code at the beginning of the function.</p>
<pre><code>
    	if(BrowserHistory.flexApplication != null) {
    		return BrowserHistory.flexApplication;
    	}
</code></pre>
<p>Then we need only to assign the Flex application instance to BrowserHistory.flexApplication from within the HTML page. When using SWFObject this requires using the swfobject.addLoadEvent() method to handle the load event before assigning the value. Then you can call swfobject.getObjectById() to get the reference to the Flex application. The following is an example of the necessary JavaScript code in the HTML page. This registers the object, handles the load event, and assigns the BrowserHistory.flexApplication reference.</p>
<pre><code>
		swfobject.registerObject("content", "9.0.0", "expressInstall.swf");
		swfobject.addLoadEvent(loadEventHandler);
		function loadEventHandler() {
			BrowserHistory.flexApplication = swfobject.getObjectById("content");
		}
</code></pre>
<p>Note that we&#8217;re assuming in this example that the id of the outer &lt;object&gt; tag is content. Also, you can read more about the SWFObject API at the <a title="SWFObject site" href="http://code.google.com/p/swfobject/" onclick="javascript:pageTracker._trackPageview('/outbound/article/code.google.com');" target="_blank">SWFObject site</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/05/28/using-flex-3-deep-linking-browsermanager-with-swfobject/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Displaying Flex Applications At 100% In Firefox</title>
		<link>http://www.themorphicgroup.com/blog/2008/05/28/displaying-flex-applications-at-100-in-firefox/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/05/28/displaying-flex-applications-at-100-in-firefox/#comments</comments>
		<pubDate>Wed, 28 May 2008 15:18:15 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
		
		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=21</guid>
		<description><![CDATA[At The Morphic Group we build Flex and ActionScript applications. This keeps us from the terrors of browsers and the various ways they interpret standards or disregard standards entirely. However, we cannot (yet?) avoid having to interface with the browser and HTML and CSS in at least one important manner. We still have to embed [...]]]></description>
			<content:encoded><![CDATA[<p>At The Morphic Group we build Flex and ActionScript applications. This keeps us from the terrors of browsers and the various ways they interpret standards or disregard standards entirely. However, we cannot (yet?) avoid having to interface with the browser and HTML and CSS in at least one important manner. We still have to embed the .swf in an HTML page, and that puts us right in the middle of the madness.</p>
<p>This post is not original. Many others have posted about the Firefox &#8220;issue&#8221; regarding displaying content at 100% height. I&#8217;m just posting a reminder, and a Flex and SWFObject-specific version. </p>
<p>The &#8220;issue&#8221; is that in most cases you probably won&#8217;t see the content or you may only see part of the content depending on the _actual_ height of the container of that content. When we build Flex applications they frequently are the only visible content in an HTML page, and the .swf itself is embedded in an otherwise empty &lt;div&gt; tag. The result is that if we&#8217;ve forgotten about this issue we&#8217;re likely to wonder why we don&#8217;t see the Flex application at all in Firefox. The reason is that Firefox is (apparently, from what I&#8217;ve read) compliant with the W3C specification for how to treat height. Apparently that specification says that when height is set to a percentage the height of the object should be a percentage relative to the height of it&#8217;s container. This is the important part. If the container of the object doesn&#8217;t have enough actual height then the content for which you&#8217;ve set the percentage will not display as you expected. Typically when we set the height to 100% we expect the content to occupy the entire height of the browser. If we haven&#8217;t correctly configured the containers to have enough height we won&#8217;t see anything showing up in Firefox.</p>
<p>The solution is to set the height of all the containers as well. Assuming that you&#8217;re embedding the .swf in a div tag nested inside the body tag, which is itself nested in the html tag then you can use the following CSS to allow the content to really display at 100%.</p>
<pre><code>
html, body, div {
  height: 100%;
}
</code></pre>
<p>We use SWFObject to embed Flex and Flash content, and we use the static publishing method with nested &lt;object&gt; tags. Therefore, the following is an example of a simple HTML page we might have to embed an .swf to 100% width and height in the browser.</p>
<pre><code>
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"&gt;
&lt;head&gt;
  &lt;title&gt;Flex Example&lt;/title&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
  &lt;script type="text/javascript" src="swfobject.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    swfobject.registerObject("flexApplication", "9.0.0");
  &lt;/script&gt;
  &lt;style&gt;
    html, body, div {
      height: 100%;
    }
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;div&gt;
    &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
        width="100%" height="100%" id="flexApplication"&gt;
        &lt;param name="movie" value="example.swf" /&gt;
        &lt;!--[if !IE]&gt;&#8211;&gt;
          &lt;object type=&#8221;application/x-shockwave-flash&#8221; data=&#8221;example.swf&#8221;
               width=&#8221;100%&#8221; height=&#8221;100%&#8221;&gt;
        &lt;!&#8211;&lt;![endif]&#8211;&gt;
          &lt;p&gt;This site is best viewed as a Flex application, which requires
                       Flash Player 9. For users who prefer not to use Flash Player we have
                       provided a &lt;a href=’textVersion.html’&gt;text-only version
                       of the site&lt;/a/&gt;.&lt;/p&gt;
        &lt;!&#8211;[if !IE]&gt;&#8211;&gt;
          &lt;/object&gt;
        &lt;!&#8211;&lt;![endif]&#8211;&gt;
    &lt;/object&gt;
  &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/05/28/displaying-flex-applications-at-100-in-firefox/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Programmatic Skinning: Drawing formatted text into a bitmapdata object</title>
		<link>http://www.themorphicgroup.com/blog/2008/05/28/programmatic-skinning-drawing-formatted-text-into-a-bitmapdata-object/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/05/28/programmatic-skinning-drawing-formatted-text-into-a-bitmapdata-object/#comments</comments>
		<pubDate>Wed, 28 May 2008 13:47:08 +0000</pubDate>
		<dc:creator>Dennis</dc:creator>
		
		<category><![CDATA[ActionScript]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=17</guid>
		<description><![CDATA[I came upon a challenge creating a custom ToggleButtonBar component. The challenge was to display dynamic text on each button while displaying button states (up, over, down, selected).  This is not a problem when you have simple formatted text. You can assign and style the text via the label property of the button. But, [...]]]></description>
			<content:encoded><![CDATA[<p>I came upon a challenge creating a custom ToggleButtonBar component. The challenge was to display dynamic text on each button while displaying button states (up, over, down, selected).  This is not a problem when you have simple formatted text. You can assign and style the text via the label property of the button. But, I needed to display two text values. One value that needed to be rotated and formatted a different way. </p>
<p>By programmaticly skinning the buttons, I was able to add uniquely formatted text to a sprite that is then drawn to the button state skin. If you&#8217;re new to Programmatic Skinning, check out Joey Lott and Chafic Kazoun&#8217;s book - Programming Flex 2.</p>
<p>Here is a scaled down version of this functionality. In most cases, you would use a different background image per button state. In this example, I am embedding one background image and a text element with an embedded font.</p>
<pre><code>
package com.myProject.skins
{
   import flash.display.BitmapData;
   import flash.display.IBitmapDrawable;
   import flash.display.Sprite;
   import flash.text.TextField;
   import flash.text.TextFieldAutoSize;
   import flash.text.TextFormat;
   import flash.text.AntiAliasType;
   import mx.controls.Button;
   import mx.core.UIComponent;
   import mx.skins.ProgrammaticSkin;

   public class CustomButtonSkin extends ProgrammaticSkin
   {

      [Embed(source='C:\\WINDOWS\\Fonts\\framd.ttf',
      fontName='FranklinMed', mimeType='application/x-font')]
      private var FranklinMed:Class;

      /* This path is assuming that you have an image in this folder */
      [Embed(source="assets/images/skinsRed.png")]
      private var skinImgRed:Class;

      public function CustomButtonSkin(){}

      override protected function updateDisplayList(unscaledWidth:Number,
           unscaledHeight:Number):void
      {
           var _backgroundImg:Sprite = new Sprite();
           var _mainSprite:Sprite = new Sprite();
           var _bitmapData:BitmapData =
                new BitmapData(int(unscaledWidth), int(unscaledHeight));
           var _mainBitmapData:BitmapData =
                new BitmapData(int(unscaledWidth), int(unscaledHeight));
           var _skinImg:IBitmapDrawable = new skinImgRed();

           /*
               Drawing the embedded image to sprite(backgroundImg)
               and then add it to mainSprite.
           */
           _bitmapData.draw(_skinImg);
           _backgroundImg.graphics.beginBitmapFill(_bitmapData);
           _backgroundImg.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
           _backgroundImg.graphics.endFill();
           _mainSprite.addChild(_backgroundImg);

           /*
              Create and format the textfield. Then add it to mainSprite.
              Note: Using an embedded font in order to change the rotation.
           */
           var _labelName:TextField = new TextField();
           _labelName.embedFonts = true;
           _labelName.textColor = 0xffffff;
           _labelName.autoSize = TextFieldAutoSize.RIGHT;
           _labelName.text = &#8220;dynamic text&#8221;; // example - Button.Data property
           var _textFormat:TextFormat = new TextFormat();
           _textFormat.font = &#8220;FranklinMed&#8221;;
           _textFormat.size = 14;
           _labelName.antiAliasType = AntiAliasType.ADVANCED;
           _labelName.setTextFormat(_textFormat);
           _labelName.rotation = -90;
           _labelName.y = 10 + _labelName.textWidth;
           _mainSprite.addChild(_labelName);

           /* Draw mainSprite to CustomButtonSkin object */
           _mainBitmapData.draw(_mainSprite);
           graphics.beginBitmapFill(_mainBitmapData);
           graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
           graphics.endFill();

      }

   }

}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/05/28/programmatic-skinning-drawing-formatted-text-into-a-bitmapdata-object/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
