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

<channel>
	<title>The Morphic Group &#187; Flash</title>
	<atom:link href="http://www.themorphicgroup.com/blog/category/technology/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.themorphicgroup.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 22 Feb 2010 18:20:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>“Content Assist” did not complete normally &#8211; bat file workaround</title>
		<link>http://www.themorphicgroup.com/blog/2009/11/03/%e2%80%9ccontent-assist%e2%80%9d-did-not-complete-normally-bat-file-workaround/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/11/03/%e2%80%9ccontent-assist%e2%80%9d-did-not-complete-normally-bat-file-workaround/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 15:34:55 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Adobe Flash Builder 4]]></category>
		<category><![CDATA[com.adobe.flexbuilder.codemodel]]></category>
		<category><![CDATA[Content Assist]]></category>
		<category><![CDATA[Flash Builder 4 beta 2]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[FlexBuilder]]></category>
		<category><![CDATA[FlexBuiler]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=334</guid>
		<description><![CDATA[Follow up to my last post. I am having to do this enough that I wrote a bat file for it. Here is what it looks like if anyone is interested. Just copy and paste the code below into a notepad and save as a .bat file. I put mine in the root of my [...]]]></description>
			<content:encoded><![CDATA[<p>Follow up to my last post.  I am having to do this enough that I wrote a bat file for it.  Here is what it looks like if anyone is interested.  Just copy and paste the code below into a notepad and save as a .bat file.  I put mine in the root of my C: drive so I can simple do Start-->Run-->fix_content_assist.bat</p>
<p>fix_content_assist.bat<br />
<code><br />
@echo off<br />
REM The following will delete the prefs file in Flash Builder 4 Beta 2 that caused content assist to break<br />
RMDIR C:\work\dev\morphic\myproject\trunk\code\as_fb4\.metadata\.plugins\com.adobe.flexbuilder.codemodel /s /q<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/11/03/%e2%80%9ccontent-assist%e2%80%9d-did-not-complete-normally-bat-file-workaround/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Content Assist&#8221; did not complete normally. Please see log for more information.</title>
		<link>http://www.themorphicgroup.com/blog/2009/10/27/content-assist-did-not-complete-normally/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/10/27/content-assist-did-not-complete-normally/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 15:44:41 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Content Assist]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flash Builder 4 beta 2]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[FlexBuilder]]></category>
		<category><![CDATA[work around]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=331</guid>
		<description><![CDATA[Here is a work around for this annoying bug in Flash Builder 4 beta 2: From: http://bugs.adobe.com/jira/browse/FB-21566 Close Flash Builder 4 beta 2 Delete this folder in your workspace: \.metadata\.plugins\com.adobe.flexbuilder.codemodel. Relaunch Flash Builder 4 beta 2]]></description>
			<content:encoded><![CDATA[<p>Here is a work around for this annoying bug in Flash Builder 4 beta 2:</p>
<p>From: http://bugs.adobe.com/jira/browse/FB-21566</p>
<p>Close Flash Builder 4 beta 2</p>
<p>Delete this folder in your workspace:</p>
<p><workspace root>\.metadata\.plugins\com.adobe.flexbuilder.codemodel.</p>
<p>Relaunch Flash Builder 4 beta 2</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/10/27/content-assist-did-not-complete-normally/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Flash Camp St Louis 2009 &#8211; Code Samples</title>
		<link>http://www.themorphicgroup.com/blog/2009/09/13/flash-camp-code-samples/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/09/13/flash-camp-code-samples/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 01:09:51 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[City Museum]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Flash Camp]]></category>
		<category><![CDATA[Flash Camp 2009]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[FlexBuilder]]></category>
		<category><![CDATA[FlexBuiler]]></category>
		<category><![CDATA[Jason Hanson]]></category>
		<category><![CDATA[St. Louis]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=272</guid>
		<description><![CDATA[I had a great time presenting at Flash Camp St Louis this last Friday. The City Museum was a great venue. All the other speakers did a great job. Thanks JP for putting together such a great event! Here is the sample code I showed in the presentation. Rt-click and select View Source for the [...]]]></description>
			<content:encoded><![CDATA[<p>I had a great time presenting at Flash Camp St Louis this last Friday.  The City Museum was a great venue.  All the other speakers did a great job.  Thanks JP for putting together such a great event!</p>
<p>Here is the sample code I showed in the presentation.  Rt-click and select View Source for the source.</p>
<p><a href="http://www2.themorphicgroup.com/blog/flashcamp2009/singleton/Singleton_Complete.html">http://www2.themorphicgroup.com/blog/flashcamp2009/singleton/Singleton_Complete.html</a><br />
<a href="http://www2.themorphicgroup.com/blog/flashcamp2009/singleton/srcview/index.html">source</a></p>
<p><a href="http://www2.themorphicgroup.com/blog/flashcamp2009/observer/Observer_Complete.html">http://www2.themorphicgroup.com/blog/flashcamp2009/observer/Observer_Complete.html</a><br />
<a href="http://www2.themorphicgroup.com/blog/flashcamp2009/observer/srcview/index.html">source</a></p>
<p><a href="http://www2.themorphicgroup.com/blog/flashcamp2009/event/Event_Complete.html">http://www2.themorphicgroup.com/blog/flashcamp2009/event/Event_Complete.html</a><br />
<a href="http://www2.themorphicgroup.com/blog/flashcamp2009/observer/srcview/index.html">source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/09/13/flash-camp-code-samples/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flash Camp St. Louis 2009 &#8211; This Friday</title>
		<link>http://www.themorphicgroup.com/blog/2009/09/08/flash-camp-st-louis-2009-this-friday/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/09/08/flash-camp-st-louis-2009-this-friday/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 16:30:28 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Adobe Catalyst]]></category>
		<category><![CDATA[City Museum]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[Flash Camp]]></category>
		<category><![CDATA[Flash Camp 2009]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[Flex Conference]]></category>
		<category><![CDATA[FlexBuilder]]></category>
		<category><![CDATA[TMG]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=262</guid>
		<description><![CDATA[Two TMG employees presenting at Flash Camp St. Louis this Friday at the City Museum, Ben Bishop and Jason Hanson. Should be a good time. If you are in St. Louis and have any interest in Flash, Flex, or Catalyst think about coming. Tickets still available. www.flashcampstlouis.com]]></description>
			<content:encoded><![CDATA[<p>Two TMG employees presenting at Flash Camp St. Louis this Friday at the City Museum, Ben Bishop and Jason Hanson.</p>
<p>Should be a good time.  If you are in St. Louis and have any interest in Flash, Flex, or Catalyst think about coming.  </p>
<p>Tickets still available.</p>
<p><a href="http://www.flashcampstlouis.com/">www.flashcampstlouis.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/09/08/flash-camp-st-louis-2009-this-friday/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Make a Flash Application into a Facebook Application and Page Tab</title>
		<link>http://www.themorphicgroup.com/blog/2009/07/09/how-to-make-a-flash-application-in-a-facebook-application-and-page-tab/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/07/09/how-to-make-a-flash-application-in-a-facebook-application-and-page-tab/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 16:22:51 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Facebook Applications]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=173</guid>
		<description><![CDATA[For the Morphic Group's Facebook page we wanted to repurpose the featured projects part of our current website into a Facebook page tab. After looking at a series of tutorials and poking and prodding till it worked, here is how we did it. What you will need: - A webserver or hosting account that can [...]]]></description>
			<content:encoded><![CDATA[<p>For the Morphic Group's <a href="http://facebook.com">Facebook</a> <a href="http://www.facebook.com/pages/The-Morphic-Group/7660059611?ref=nf">page</a> we wanted to repurpose the featured projects part of our current <a href="http://themorphicgroup.com/#featuredProjects">website</a> into a Facebook page tab. After looking at a series of <a href="http://www.insideria.com/series-facebook-dev.html">tutorials</a> and poking and prodding till it worked, here is how we did <a href="http://apps.facebook.com/tmgportfolio/">it</a>.</p>
<p><strong>What you will need:</strong></p>
<p>- A webserver or hosting account that can run PHP<br />
- A Facebook account<br />
- The Facebook Developer app installed in your Facebook account<br />
- If your Flash app needs to load xml or images from your hosted domain, access to your crossdomain xml file at hosted domain</p>
<p><strong>Part 1 Setup your Flash Application on your Server</strong></p>
<p>1. Create a directory on your web server for all of your files. For TMG, I created a directory &quot;facebook&quot; and inside that folder I created another folder &quot;portfolio.&quot;</p>
<p>2. Upload your Flash app swf and its supporting files. In my case, since my app was built with Flex this consisted of my images and xml assets folder, the generated HTML file, and the compiled swf for my app.</p>
<p>3. Create a &quot;tab&quot; folder. In the &quot;portfolio&quot; folder I previously created, I added a &quot;tab&quot; folder. We need this folder for when a user makes your Facebook app into a tab. When an app is made into a tab, Facebook will want a different set of files to use. This is because developers sometimes want their apps to look or behave differently if their app is implemented as a tab.</p>
<p>4. Copy the files Facebook should use when your application gets implemented as a tab. In my case, I just copied the same files from the &quot;portfolio&quot; directory into the &quot;tab&quot; directory.</p>
<p><strong>Part 2 Setup your Application in Facebook</strong></p>
<p>1. Click on the &quot;Developer&quot; app button under the &quot;Applications&quot; button in your Facebook control bar at the bottom of the page.</p>
<p>2. Click &quot;Set Up New Application&quot; in the upper right of the Developer page.</p>
<p>3. Type in your Application name, accept the Facebook Terms, and click &quot;Save Changes.&quot;</p>
<p>4. You will now be taken to the &quot;Basic&quot; tab of your application. In this tab, you can edit the Application Name, Description, Icon/Logo, Developer Contact Email, and auxilary URLs for your app. For our interactive portfolio, we just updated our description and icon/logo. When done, click &quot;Save Changes.&quot;</p>
<p>5. Next click on &quot;Authentication&quot; on the left. Be sure to check &quot;Users&quot; and &quot;Facebook Pages.&quot; For the Post-Authorize and Post-Remove Callback URLs, enter the following:<br />
http://www2.themorphicgroup.com/{the directory your swf is hosted at on your sever}/index.php  </p>
<p>For the TMG portfolio app it is:</p>
<p>http://www2.themorphicgroup.com/facebook/portfolio/index.php</p>
<p>Click &quot;Save Changes&quot; when you are done.</p>
<p>6. To setup our tab configuration, click &quot;Profiles&quot; in the left menu. Enter in your Tab Name and tab URL. For example, we entered &quot;TMG Portfolio&quot; as the tab name and &quot;tab/tab.php&quot; for the &quot;Tab URL.&quot; The &quot;Tab URL&quot; field basically tells Facebook where to find the files to use for the tab. Click &quot;Save Changes.&quot;</p>
<p>7. Click &quot;Canvas&quot; on the menu to the left. Enter your &quot;Canvas Page URL&quot; (ex: &quot;tmgportfolio&quot;.) Next, enter the &quot;Canvas Callback URL&quot; for your app. This should be the full URL path to where your Flash app resides. For the TMG Portfolio app it is:</p>
<p>http://www2.themorphicgroup.com/facebook/portfolio/</p>
<p>8. Make sure &quot;IFrame&quot; is selected for &quot;Render Method&quot; and then click &quot;Save Changes.&quot;</p>
<p><strong>Part 3 Setup the PHP on your Server</strong></p>
<p>1. Click &quot;Back to My Applications&quot; at the top of the Developer UI.</p>
<p>2. Click &quot;Download the Client Library&quot; link at the bottom of the Developer UI. Once download, extract the files and then upload them to your Flash app's web directory. For the TMG app this directory was:<br />
  /facebook/portfolio/  
</p>
<p>3. Click on the &quot;example code&quot; link three quarters of the way down the page. Follow Step 2: Create an &quot;index.php&quot; File in the &quot;Quick Creation Guide&quot; popup.</p>
<p>4. Modify the index.php file for your Flash app. For TMG Portfolio app this is the only PHP I had:</p>
<p>&lt;?php<br />
  // Copyright 2007 Facebook Corp.  All Rights Reserved. <br />
  // <br />
  // Application: The Morphic Group Portfolio<br />
  // File: 'index.php' <br />
  //   This is a sample skeleton for your application. <br />
// </p>
<p>require_once 'facebook.php';</p>
<p>$appapikey = '#########################';<br />
  $appsecret = '##########################';<br />
  $facebook = new Facebook($appapikey, $appsecret);<br />
  $user_id = $facebook-&gt;require_login();</p>
<p>?&gt;</p>
<p>After the PHP block, I cut and pasted in the HTML for my Flash app that was generated by Flex. Note: I removed the api key and secret for privacy reason.</p>
<p>5. Create your tab.php file. This will be the PHP that will be used to render the tab version of your applicaiton. For our application, this is only one line:<br />
&lt;fb:swf swfbgcolor=&quot;000000&quot; imgstyle=&quot;border-width:3px; border-color:white;&quot; swfsrc='http://www2.themorphicgroup.com/facebook/portfolio/TMG_FB_Portfolio.swf' imgsrc='http://www2.themorphicgroup.com/facebook/portfolio/fbSplash.jpg' width='600' height='570' /&gt; </p>
<p>FBML is a markup language that Facebook uses to render apps. In this example note that we specify an &quot;imgsrc&quot; attribute in addition to the &quot;swfsrc&quot; attribute. The image specified is used as a splash graphic of sorts, because a Flash swf in a tab is not activated until a user clicks on it.</p>
<p><strong>Part 4 Test and Implement Application</strong></p>
<p>1. Click on the link under &quot;Step 3: Test Your Application&quot; in the &quot;Quick Creation Guide&quot; popup, or you can go to your canvas URL directly (ex: http://apps.facebook.com/tmgportfolio.)</p>
<p>2. You should now see your application running in Facebook. </p>
<p>3. Go back to your application's page in &quot;My Applications&quot; and click on &quot;View Application Profile&quot; in the menu on the right.</p>
<p>4. Once on the application's profile page, click &quot;More&quot; in the menu to the left. You should see an option &quot;Add to my Page.&quot; After clicking, you will be asked what page you would like this to be added to.</p>
<p>5. After selecting the appropriate page, your application should now be visible as a tab.</p>
<p>&nbsp;</p>
<p>There you have it. If all went well and I didn't miss anything in this tutorial, you should now have a cooler Facebook page. If there is anything I missed, or if you run into any issues that aren't covered here, please leave a comment and I'll update this blog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/07/09/how-to-make-a-flash-application-in-a-facebook-application-and-page-tab/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Flash ContextMenu</title>
		<link>http://www.themorphicgroup.com/blog/2009/07/06/contextmenu-copy-paste-delete/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/07/06/contextmenu-copy-paste-delete/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 13:45:45 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[ContextMenu]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[FlexBuilder]]></category>
		<category><![CDATA[paste]]></category>
		<category><![CDATA[rt-click menu]]></category>
		<category><![CDATA[The Morphic Group]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=166</guid>
		<description><![CDATA[Recently I attempted at add copy, paste, delete to a ContextMenu (rt-click menu) of a Flash movie. I quickly discovered that copy, paste, and delete are reserved words and cannot be used. I tried the trick of putting a space after the words, i.e. "copy ". That did not work. I found a decent work [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I attempted at add <strong>copy</strong>, <strong>paste</strong>, <strong>delete </strong>to a ContextMenu (rt-click menu) of a Flash movie.  I quickly discovered that copy, paste, and delete are reserved words and cannot be used.  I tried the trick of putting a space after the words, i.e. "copy ".  That did not work.  </p>
<p>I found a decent work around.  I added a non-breaking space to the end of each string and that was enough of a change to get copy, paste, and delete to show up in my context menu.  The unicode character for a non-breaking space is <strong>00A0</strong>.  The syntax looks like this "<strong>\u00A0</strong>".</p>
<pre class="actionscript3" style="font-family:monospace;">elementContextMenu = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=contextmenu%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:contextmenu.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">ContextMenu</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
elementContextMenu.<span style="color: #004993;">hideBuiltInItems</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #6699cc; font-weight: bold;">var</span> cutItem<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=contextmenuitem%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:contextmenuitem.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">ContextMenuItem</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=contextmenuitem%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:contextmenuitem.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">ContextMenuItem</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Cut<span style="">\u</span>00A0&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> copyItem<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=contextmenuitem%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:contextmenuitem.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">ContextMenuItem</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=contextmenuitem%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:contextmenuitem.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">ContextMenuItem</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Copy<span style="">\u</span>00A0&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> pasteItem<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=contextmenuitem%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:contextmenuitem.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">ContextMenuItem</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=contextmenuitem%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:contextmenuitem.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">ContextMenuItem</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Paste<span style="">\u</span>00A0&quot;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
cutItem.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=contextmenuevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:contextmenuevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">ContextMenuEvent</span></a>.<span style="color: #004993;">MENU_ITEM_SELECT</span>, onCutItem<span style="color: #000000;">&#41;</span>;
copyItem.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=contextmenuevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:contextmenuevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">ContextMenuEvent</span></a>.<span style="color: #004993;">MENU_ITEM_SELECT</span>, onCopyItem<span style="color: #000000;">&#41;</span>;
pasteItem.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=contextmenuevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:contextmenuevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">ContextMenuEvent</span></a>.<span style="color: #004993;">MENU_ITEM_SELECT</span>, onPasteItem<span style="color: #000000;">&#41;</span>;
&nbsp;
elementContextMenu.<span style="color: #004993;">customItems</span>.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>cutItem<span style="color: #000000;">&#41;</span>;
elementContextMenu.<span style="color: #004993;">customItems</span>.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>copyItem<span style="color: #000000;">&#41;</span>;
elementContextMenu.<span style="color: #004993;">customItems</span>.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>pasteItem<span style="color: #000000;">&#41;</span>;
&nbsp;
Application.application.<span style="color: #004993;">contextMenu</span> = elementContextMenu;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/07/06/contextmenu-copy-paste-delete/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adobe Flash Builder and Catalyst Tips, Tricks, and Hacks</title>
		<link>http://www.themorphicgroup.com/blog/2009/06/23/adobe-flash-builder-and-catalyst-tips-tricks-and-hacks/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/06/23/adobe-flash-builder-and-catalyst-tips-tricks-and-hacks/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 17:04:19 +0000</pubDate>
		<dc:creator>Ben</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=86</guid>
		<description><![CDATA[Adobe Catalyst was released at the beginning of June with great fanfare, and with that positive buzz a lot of tutorials have been created that demonstrate how quickly a developer can go from a Catalyst project to a Flash Builder project to a working application. However, there aren't many tutorials on how to go back [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://labs.adobe.com/technologies/flashcatalyst/">Adobe Catalyst</a> was released at the beginning of June with great fanfare, and with that positive buzz a lot of <a href="http://labs.adobe.com/technologies/flashcatalyst/tutorials/">tutorials</a> have been created that demonstrate how quickly a developer can go from a Catalyst project to a <a href="http://livedocs.adobe.com/flex/gumbo/html/WS65aa2914f20a58ebd123e2512119993c71-8000.html">Flash Builder</a> project to a working application. However, there aren't many tutorials on how to go back and forth between Catalyst and Flash Builder during production. The reason is that this type of &quot;roundtrip&quot; functionality doesn't officially exist (yet.) Currently, once a developer modifies the Catalyst generated code to hook buttons to handlers or data lists to services they void their warranty with Catalyst. Conversly, Catalyst can't read fxp files generated by Flash Builder, nor can a developer simply just reimport the project from Catalyst without their custom code getting overwritten.</p>
<p>With these limitations, it seems like Catalyst is limited to prototyping. Subsequently the burden of converting a design to a functioning application and implementing design revisions still predominately rests on the shoulders of the developer. </p>
<p>After working with Catalyst and Flash Builder for the past couple of days, I think I have a process in place that keeps Catalyst involved in the course of a production cycle. With these tips and tricks, you should be able to frequently reimport a Catalyst project and have your Flash Builder project update without having to worry about the aforementioned pitfalls of code getting lost/overwritten.</p>
<p><strong>Keep your Catalyst project flat</strong>.</p>
<p>What do I mean by &quot;flat?&quot; When I first started working with Catalyst, I created complex components within complex components. For example, I would create a screen component. Then inside that screen component, I would create a panel component. Inside that panel component I would create a button. This may seem natural and a great way to organize your UI elements, but because you currently cannot declare what the &quot;id&quot; attribute of a component is in Catalyst there isn't a way for you to do something like put a click handler on your button without going into that panel component and adding it in the code with Flash Builder. This, as I mentioned earlier, voids your warranty with Catalyst. So how can you avoid this situation?</p>
<p>Keep all of your components on the root layer of your project. </p>
<p>Avoid having components embedded in components. </p>
<p>If you do this, when you import your Catalyst project into Flash Builder you'll be able pick and choose what components you want to use and where you will want to use them.</p>
<p><strong>Think in terms of skins and not components.</strong></p>
<p>When I say &quot;skin,&quot; I do not mean a <a href="http://danorlando.com/?p=374">Spark</a> <a href="http://livedocs.adobe.com/flex/gumbo/langref/spark/skins/SparkSkin.html">Skin</a> in the strictest sense. This is because Catalyst can only declare a component as being a <a href="http://livedocs.adobe.com/flex/gumbo/langref/spark/components/Button.html">Button</a>, <a href="http://livedocs.adobe.com/flex/gumbo/langref/spark/components/TextInput.html">TextInput</a>, DataList, or a Custom Component. Hopefully, Adobe will add this feature in a future beta. In the meantime, I tend to create custom components to act as backgrounds and other parts for my Flash Builder components. (I will demonstrate how to execute this later in the post.)</p>
<p><strong> Be sure to give good names to your Catalyst components</strong>.</p>
<p>As you build custom components, be sure to go into the library panel for your project in Catalyst and change the names to something more meaningful than &quot;CustomComponent1.&quot;</p>
<p><strong>Don't touch the components from Catalyst after importing them into Flash Builder.</strong></p>
<p>By default, Catalyst puts all of your custom components in a &quot;components&quot; directory. If you select &quot;code&quot; from the view options in the upper right, you can see this directory structure. When you create a new Flex project from your Catalyst fxp file or import it into an existing Flex project, you will also see this folder. Do not touch or modify the code of the components in this directory. If you do, do so at your own risk. Just keep in mind that all of your code in this components directory will get overwritten  with a later import.</p>
<p>Note: I tried changing this folder structure in code view of Catalyst, but it seems to break the design view of Catalyst.</p>
<p><strong>Implement Catalyst custom components as &quot;skins.&quot;</strong></p>
<p>Here's a mxml component I created in Flash Builder called MyPanel.mxml that uses two custom components I created in Catalyst:</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Group
     xmlns<span style="color: #000000; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span>
     xmlns<span style="color: #000000; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span>
     xmlns<span style="color: #000000; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/halo&quot;</span>
     <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span>
     <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span>
     xmlns<span style="color: #000000; font-weight: bold;">:</span>components=<span style="color: #990000;">&quot;components.*&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
     <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>layout<span style="color: #000000; font-weight: bold;">&gt;</span>
          <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>BasicLayout<span style="color: #000000; font-weight: bold;">/&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>layout<span style="color: #000000; font-weight: bold;">&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;</span>components<span style="color: #000000; font-weight: bold;">:</span>MyCatalystPanelBG id=<span style="color: #990000;">&quot;myPanelBG&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;</span>components<span style="color: #000000; font-weight: bold;">:</span>MyCatalystHeaderBG id=<span style="color: #990000;">&quot;myPanelHeaderBG&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;5&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>Group<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;</pre>
<p>By using BasicLayout I can overlap these elements and position them exactly where I want. To add the actual contents of this panel (like buttons, textinputs, lists, etc...) I just add them after the two custom Catalyst components like so:</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Group
     xmlns<span style="color: #000000; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span>
     xmlns<span style="color: #000000; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span>
     xmlns<span style="color: #000000; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/halo&quot;</span>
     <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span>
     <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span>
     xmlns<span style="color: #000000; font-weight: bold;">:</span>components=<span style="color: #990000;">&quot;components.*&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
     <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>layout<span style="color: #000000; font-weight: bold;">&gt;</span>
          <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>BasicLayout<span style="color: #000000; font-weight: bold;">/&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>layout<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
     <span style="color: #000000; font-weight: bold;">&lt;</span>components<span style="color: #000000; font-weight: bold;">:</span>MyCatalystPanelBG id=<span style="color: #990000;">&quot;myPanelBG&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;</span>components<span style="color: #000000; font-weight: bold;">:</span>MyCatalystHeaderBG id=<span style="color: #990000;">&quot;myPanelHeaderBG&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;5&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
     <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>TextInput
          id=<span style="color: #990000;">&quot;searchTextInput&quot;</span>
          <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;7&quot;</span>
          <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Enter search criteria here&quot;</span>
          <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;7&quot;</span>
     <span style="color: #000000; font-weight: bold;">/&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>List
          id=<span style="color: #990000;">&quot;itemsList&quot;</span>
          <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span>
          <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;40&quot;</span>
          <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;10&quot;</span>
          <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;10&quot;</span>
          <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;10&quot;</span>
&nbsp;
          <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>Group<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;</pre>
<p>The beauty with this approach is that if something changes in the Catalyst project, I can import it again without having to worry about losing the business code I have written in Flash Builder.</p>
<p><strong>Use <a href="http://livedocs.adobe.com/flex/gumbo/langref/spark/components/Group.html#propertySummary">mxmlContent</a> to make skins automatically resize</strong>.</p>
<p>You may have noticed in Catalyst you can only declare the height and width of elements as fixed numbers and not percentages. This may be suitable when creating a prototype, but a good Flex app needs to be able to resize as browser height and widths change. The solution? With the new Spark Group component there is a property called &quot;mxmlContent&quot; that is an array of all of the visible children of the component. How do we use this? Let's say the mxml for the component MyCatalystPanelBG looks like this:</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Group xmlns<span style="color: #000000; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> xmlns<span style="color: #000000; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> xmlns<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">d</span>=<span style="color: #990000;">&quot;http://ns.adobe.com/fxg/2008/dt&quot;</span> xmlns<span style="color: #000000; font-weight: bold;">:</span>components=<span style="color: #990000;">&quot;components.*&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;0.5&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;700&quot;</span> radiusX=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;238&quot;</span> <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;0.5&quot;</span> radiusY=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">d</span><span style="color: #000000; font-weight: bold;">:</span>userLabel=<span style="color: #990000;">&quot;PanelBG&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
          <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>stroke<span style="color: #000000; font-weight: bold;">&gt;</span>
               <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>SolidColorStroke weight=<span style="color: #990000;">&quot;1&quot;</span> caps=<span style="color: #990000;">&quot;none&quot;</span> joints=<span style="color: #990000;">&quot;miter&quot;</span> miterLimit=<span style="color: #990000;">&quot;4&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#808080&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
          <span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>stroke<span style="color: #000000; font-weight: bold;">&gt;</span>
          <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>fill<span style="color: #000000; font-weight: bold;">&gt;</span>
               <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>LinearGradient <span style="color: #004993;">rotation</span>=<span style="color: #990000;">&quot;90&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
                    <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>GradientEntry <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#ffffff&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;1.0&quot;</span> ratio=<span style="color: #990000;">&quot;0&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
                    <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>GradientEntry <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#d8d8d8&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;1.0&quot;</span> ratio=<span style="color: #990000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
               <span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>LinearGradient<span style="color: #000000; font-weight: bold;">&gt;</span>
          <span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>fill<span style="color: #000000; font-weight: bold;">&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>Rect<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>Group<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;</pre>
<p>We can make this background scale with our panel component by doing the following:</p>
<p>Add a &quot;<a href="http://livedocs.adobe.com/flex/gumbo/langref/mx/core/UIComponent.html#event:creationComplete">creationComplete</a>&quot; handler in MyPanel.mxml.</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Group
     xmlns<span style="color: #000000; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span>
     xmlns<span style="color: #000000; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span>
     xmlns<span style="color: #000000; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/halo&quot;</span>
     <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span>
     <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span>
     xmlns<span style="color: #000000; font-weight: bold;">:</span>components=<span style="color: #990000;">&quot;components.*&quot;</span>
     creationComplete=<span style="color: #990000;">&quot;onCC()&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
          <span style="color: #000000; font-weight: bold;">&lt;</span>fx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
          <span style="color: #000000; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
               <span style="color: #0033ff; font-weight: bold;">import</span> spark.primitives.Rect;
               <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onCC<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> r<span style="color: #000000; font-weight: bold;">:</span>Rect = myPanelBG.mxmlContent<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span> <span style="color: #0033ff; font-weight: bold;">as</span> Rect;
                    r.<span style="color: #004993;">top</span> = <span style="color: #000000; font-weight:bold;">0</span>;
                    r.<span style="color: #004993;">left</span> = <span style="color: #000000; font-weight:bold;">0</span>;
                    r.<span style="color: #004993;">right</span>=<span style="color: #000000; font-weight:bold;">0</span>;
                    r.<span style="color: #004993;">bottom</span>=<span style="color: #000000; font-weight:bold;">0</span>;
               <span style="color: #000000;">&#125;</span>
           <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;/</span>fx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;</pre>
<p>Also be sure to set the height and width of the &quot;myPanelBG&quot; to 100%.</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>components<span style="color: #000000; font-weight: bold;">:</span>MyCatalystPanelBG id=<span style="color: #990000;">&quot;myPanelBG&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;</pre>
<p>The mxmlContent property is nice in that you don't have to worry about looping through sub children like you do with &quot;getChildAt(i)&quot; to get to what you want. This line of code basically says &quot;get the first content item which is a rectangle element and set its right, top, bottom, and left properties to 0.&quot;</p>
<p>NOTE: This hack is very dependent that the order of elements don't change in your Catalyst components. Whenever updating these components you may need to check to see if the structure has changed in these components. You could do something like have a loop that goes through all of the items in mxmlContent and changes these properties on any <a href="http://livedocs.adobe.com/flex/gumbo/langref/spark/primitives/Rect.html">Rect</a>s.</p>
<p><strong>To bind strings to text items in a Catalyst custom component, use BindUtil.</strong></p>
<p>Let's say you have a <a href="http://livedocs.adobe.com/flex/gumbo/langref/spark/primitives/RichText.html">RichText</a> component inside your header &quot;skin:&quot;</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Group xmlns<span style="color: #000000; font-weight: bold;">:</span>s=<span style="color: #990000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> xmlns<span style="color: #000000; font-weight: bold;">:</span>fx=<span style="color: #990000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> xmlns<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">d</span>=<span style="color: #990000;">&quot;http://ns.adobe.com/fxg/2008/dt&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;0.5&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;23&quot;</span> radiusX=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;737&quot;</span> <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;0.5&quot;</span> radiusY=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">d</span><span style="color: #000000; font-weight: bold;">:</span>userLabel=<span style="color: #990000;">&quot;Header BG&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
          <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>fill<span style="color: #000000; font-weight: bold;">&gt;</span>
               <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>LinearGradient <span style="color: #004993;">rotation</span>=<span style="color: #990000;">&quot;90&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
                    <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>GradientEntry <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#bf0000&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;1.0&quot;</span> ratio=<span style="color: #990000;">&quot;0&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
                    <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>GradientEntry <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#7f0000&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;1.0&quot;</span> ratio=<span style="color: #990000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
               <span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>LinearGradient<span style="color: #000000; font-weight: bold;">&gt;</span>
          <span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>fill<span style="color: #000000; font-weight: bold;">&gt;</span>
          <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>stroke<span style="color: #000000; font-weight: bold;">&gt;</span>
               <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>SolidColorStroke <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#7f0000&quot;</span> caps=<span style="color: #990000;">&quot;none&quot;</span> joints=<span style="color: #990000;">&quot;miter&quot;</span> miterLimit=<span style="color: #990000;">&quot;4&quot;</span> weight=<span style="color: #990000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
          <span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>stroke<span style="color: #000000; font-weight: bold;">&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>Rect<span style="color: #000000; font-weight: bold;">&gt;</span>
     <span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>RichText <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#ffffff&quot;</span> <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;7&quot;</span> <span style="color: #004993;">fontSize</span>=<span style="color: #990000;">&quot;17&quot;</span> fontFamily=<span style="color: #990000;">&quot;Arial&quot;</span> fontWeight=<span style="color: #990000;">&quot;bold&quot;</span> <span style="color: #004993;">d</span><span style="color: #000000; font-weight: bold;">:</span>userLabel=<span style="color: #990000;">&quot;Title&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>s<span style="color: #000000; font-weight: bold;">:</span>Group<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;</pre>
<p>To bind the RichText component to a property in MyPanel.mxml do the following.</p>
<p>Add a title variable to MyPanel.mxml:</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> title<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;My Panel Title&quot;</span>
&nbsp;</pre>
<p>In the creation complete handler add the following:</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
BindingUtils.bindProperty<span style="color: #000000;">&#40;</span>myPanelHeaderBG.mxmlContent<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span>, <span style="color: #990000;">&quot;text&quot;</span>, <span style="color: #0033ff; font-weight: bold;">this</span>, <span style="color: #990000;">&quot;title&quot;</span><span style="color: #000000;">&#41;</span>;
&nbsp;</pre>
<p>In this scenario, the RichText component is the second item hence the &quot;mxmlContent[1].&quot; That's all you need.</p>
<p><strong>To manage your Catalyst component's state bind it to your Flash Builder component's state.</strong></p>
<p>Let's say you want your &quot;skin&quot; component to have it's state mirror your component that you've written in Flash Builder. To do this all you have to do is this:</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>components<span style="color: #000000; font-weight: bold;">:</span>MyCatalystPanelBG id=<span style="color: #990000;">&quot;myPanelBG&quot;</span> currentState=<span style="color: #990000;">&quot;{this.currentState}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;</pre>
<p>Note: You need to be sure that you've created all of the necessary states in Catalyst for your skin.</p>
<p><strong>Make your bitmap artwork in Catalyst custom components</strong></p>
<p>This will make managing and swapping out bitmaps much easier as your app's design evolves.</p>
<p><strong>Summary</strong></p>
<p>That should basically do it. A lot of what I have prescribed in here is a bit of a hack until Adobe expands Catalyst's abilities beyond prototyping. However, in the meantime this is still a workable solution to leverage Catalysts abilities in your production phase of your project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/06/23/adobe-flash-builder-and-catalyst-tips-tricks-and-hacks/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A Taste of “Flash on Tap” 2009</title>
		<link>http://www.themorphicgroup.com/blog/2009/06/06/a-taste-of-%e2%80%9cflash-on-tap%e2%80%9d/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/06/06/a-taste-of-%e2%80%9cflash-on-tap%e2%80%9d/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 23:18:39 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Flash Events]]></category>
		<category><![CDATA[Flex Conference]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=81</guid>
		<description><![CDATA[A week ago this night, the first “Flash on Tap” conference was winding down as the rocking reggae band (Toussaint and the China Band) finished their set. It was fitting end to an unconventional meeting of design and development professionals; a Flash conference/Micro-beer festival mash-up. The main focus of this three day convention was the [...]]]></description>
			<content:encoded><![CDATA[<p>A week ago this night, the first “<a title="Flash on Tap" href="http://www.flashontap.com" target="_blank">Flash on Tap</a>” conference was winding down as the rocking reggae band (<a href="http://www.myspace.com/toussaintandthechinaband" target="_blank">Toussaint and the China Band</a>) finished their set. It was fitting end to an unconventional meeting of design and development professionals; a Flash conference/Micro-beer festival mash-up.</p>
<p>The main focus of this three day convention was the presentations and sessions on a variety of topics such as pixel manipulation, animation, programing design patterns, accessibility, broadcast media, sound, and video. What comes to mind are all of the tasty tidbits of knowledge smoothly gulped down like a frosty IPA.</p>
<p>Day one started out with a series of workshops. My workshop of choice was <a href="http://blog.papervision3d.org/" target="_blank">Papervision 3D</a> presented by <a href="http://rockonflash.wordpress.com/2009/05/31/flash-on-tap-slides/" target="_blank">John Grden</a> and <a href="http://blog.zupko.info/" target="_blank">Andy Zupko</a>. The first half with John was a great overview of basics. The next half included the advanced and new features of PV3D. John and Andy kept a steady pace making sure that the attendees were involved throughout in the session.   I was most impressed with the new amazing features of layers and effects. Keep in mind that this was only a day workshop that is covered in two days.<br />
Good job guys.</p>
<p>The next two days consisted of breakout sessions and keynote presentations. Unfortunately<br />
I could not attend all of these presentations. From what I've heard from the attendees,<br />
everyone was pleased with the content presented throughout the conference.</p>
<p>Briefly... I will go though some of the session I did attend:</p>
<ul>
<li> Building Social applications with <a href="http://coenraets.org/" target="_blank">Christophe Conraets</a> was great eye opener to projects you can do with Actionscript API for Facebook and <a href="http://labs.adobe.com/technologies/afcs/" target="_blank">Adobe Flash Collaboration Service (formerly named "Cocomo"):</a>.</li>
<li><a href="http://blog.joa-ebert.com/" target="_blank">Joa Ebert</a> presented some great tools (including <a title="Hobnox Open Source" href="http://opensource.hobnox.com/" target="_blank">Hobnox Open Source</a>) and development disciplines.</li>
<li>Every time I attend a session related to Big Spaceship, I'm always entertained as well has inspired. Jamie Kosoy gave us a backstage look at the process of Big Spaceship... Very cool. From <a href="http://www.bigspaceship.com/blog/labs/flash-on-tap-slides" target="_blank">Ten fundamentals of the process</a>, my favorite was number 6: Buy the developer Whiskey! … indeed … (Make mine Bushmills, Sam).</li>
<li><a title="dr woohoo blog" href="http://blog.drwoohoo.com/" target="_blank">Dr. Woohow</a> gave an exceptional presentation of mixing it up with applications to create<br />
some amazing visual landscapes.</li>
<li><a href="http://www.forestandthetrees.com/" target="_blank">Doug Marttilla</a> attempted to go through ten design patterns within an hour and succeeded. By presenting his own insight into each pattern, he gave an overall good presentation. You rock!</li>
<li>Who couldn't learn a thing or two about video production from a guy like <a href="http://blogs.flashsupport.com/robert/" target="_blank">Robert Reinhardt</a>, A true innovator. It was a power packed session. He's got a really great project coming up - <a href="http://www.videorx.com/" target="_blank">VideoRX</a>.</li>
</ul>
<p>The bigger presentations at the Castle were outstanding even with a ruckus beer festival going on. Grant Skinner… Mark  Anders… Andre  Michelle...  Gmunk... Keith Peters… Chuck Freedman … Mario Klingerman and of course Hoss Gifford. (I may have missed a few presentations... my apologies)</p>
<p>Of course... there were the parties and beer tastings at the end of each day at The Castle.<br />
This was  challenging place to incorporate speakers on stage with the combination of socializing,<br />
beer and food. Unlike most of the conferences there was better chance to meet and talk to more people in this forum. Maybe it was added element of beer. It all seemed to work out well. I don't<br />
think anyone was thrown out for rude behavior ... (Todd ?).</p>
<p>Favorite events: (Day 2) The Flash is Right with Host Philip Kerman and (Day 3) <a href="http://www.myspace.com/toussaintandthechinaband" target="_blank">Toussaint and the China Band</a><a href="http://www.myspace.com/toussaintandthechinaband" target="_blank"><br />
</a></p>
<p>The convergence of learning, drinking, and hobnobbing for three days was a success for the organizers and partners. All who attended were treated to the best talent, not to mention some<br />
great micro-beers. Special shout out to the Park Plaza Hotel- great venue.</p>
<p>Having gone to a few out of town conferences on Flash, design and development, I was happy<br />
and proud that this one was held in my own backyard, Boston.</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/06/06/a-taste-of-%e2%80%9cflash-on-tap%e2%80%9d/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Web Ads with ClickTags</title>
		<link>http://www.themorphicgroup.com/blog/2009/04/10/web-ads-with-clicktags/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/04/10/web-ads-with-clicktags/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 20:54:47 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ClickTag]]></category>
		<category><![CDATA[flash cs3]]></category>
		<category><![CDATA[Web Ad]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=74</guid>
		<description><![CDATA[When creating web ads for third party companies, you maybe asked to add a clickTag, a reference to an external variable. The variable is passed from within the html Object/Embed tags via query string or FlashVar parameter. This allows an ad manager to track the click-through of the Flash SWF. Usually, the ad manager would [...]]]></description>
			<content:encoded><![CDATA[<p>When creating web ads for third party companies, you maybe asked to add a clickTag,<br />
a reference to an external variable. The variable is passed from within the html Object/Embed tags via query string or FlashVar parameter. This allows an ad manager to track the click-through of the<br />
Flash SWF. Usually, the ad manager would create an ad server value with the target url address. As the developer, you need to reference this variable from within your project.</p>
<p>Let's walk though a solution for building a Flash ad (in AS 3.0) with a clickTag. <em>Note: In most cases, ad companies and developers are required to use AS 2.0. There are plenty of great articles that discuss this implementation. There is an adobe article that is widely used <a href="http://www.adobe.com/resources/richmedia/tracking/designers_guide/" target="_new">Designer's Guide: Building Macromedia Flash Banners with Tracking Capabilities</a>. This article will not discuss this how to create ads with clickTags using AS 2.0 .</em></p>
<p>The ad manager will also want to prevent the click-through target from being blocked by any<br />
popup blockers. This usually the case with certain web browsers like IE 7.0+. Note: At this<br />
time there is a new Flash player version out (version 11). I don't know if this issue is fixed.</p>
<p style="margin-bottom: 0in;">So we have three requirements …</p>
<ul>
<li>
<p style="margin-bottom: 0in;">Get a reference to the clickTag 	variable</p>
</li>
<li>
<p style="margin-bottom: 0in;">Build your web ad with AS 3.0</p>
</li>
<li>
<p style="margin-bottom: 0in;">Handle the issue with the Popup 	Blockers</p>
</li>
</ul>
<p>Here is an example of code for satisfying these requirements.</p>
<p>html embed parameter<br />
...<br />
&lt;param name="FlashVars" value="clickTag=http://www.adserver.com/target.php?track=1123" /&gt;<br />
...</p>
<p>actionscript code</p>
<pre><code>
package
{

import flash.external.ExternalInterface;
import flash.net.navigateToURL;
import flash.net.URLRequest;

public class Main extends MovieClip
{
  private var paramList:Object;
  public var clickTag:String = ""; 

  function Main()
  {
    paramList = this.root.loaderInfo.parameters;

    if(paramList["clickTag"] != null)
    {
        clickTag = paramList["clickTag"];
    }

    clickTagBtn.addEventListener(MouseEvent.CLICK, onClick);

  } 

  function onClick( event:MouseEvent ):void
  {
    if( clickTag != ""  )
    {
      var req:URLRequest = new URLRequest(clickTag);

      if ( !ExternalInterface.available )
      {
        navigateToURL(req, "_blank");
      }
      else
      {
        var strUserAgent:String =
          String(ExternalInterface.call(
		"function() {return navigator.userAgent;}"
		)).toLowerCase();

        if ( strUserAgent.indexOf("firefox") != -1 )
        {
          ExternalInterface.call( "window.open", req.url, "_blank" );
        }
        else
        {
          if( strUserAgent.indexOf("msie") != -1 &amp;&amp;
            uint(strUserAgent.substr(strUserAgent.indexOf("msie") + 5, 3)) &gt;= 7 )
          {
            ExternalInterface.call("window.open", req.url, "_top");
          }
          else
          {
            navigateToURL(req, "_top");
          }
        }
      }
    }

  }

}

}

</code></pre>
<p>I am assuming that you are using Flash CS 3 or greater and that Main is your document class for your fla project.</p>
<p style="margin-bottom: 0in;">First I need to get the get the value of the clickTag.</p>
<ul>
<li>
<p style="margin-bottom: 0in;">Reference the 	loaderInfo.parameters as an Object and then reference the key value 	of clickTag.</p>
</li>
<li>
<p style="margin-bottom: 0in;">The character's case is very 	important. Letter case is important, otherwise you won't be able to 	reference this value.</p>
</li>
</ul>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;">The key to handling the issue with popup blockers is to use a little javascript, with the help of External interface.</p>
<ul>
<li>
<p style="margin-bottom: 0in;">If ExternalInterface is not available, use 	NavigateToUrl directly.</p>
</li>
<li>
<p style="margin-bottom: 0in;">Get the userAgent (browser) 	information via javascript. I use this info to handle browser 	different quirks.</p>
</li>
<li>
<p style="margin-bottom: 0in;">Call the javascript method 	window.open to open the link specified by the clickTag value.  It is 	absolutely necessary to enable AllowScripting for “sameDomain” 	or “always” . Otherwise a security sandbox error will display.</p>
</li>
</ul>
<p>This solution should get you out of most jams in regards to ClickTag functionality using AS 3.0 .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/04/10/web-ads-with-clicktags/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting Parameters With The Same Name Using URLVariables</title>
		<link>http://www.themorphicgroup.com/blog/2009/03/20/setting-parameters-with-the-same-name-using-urlvariables/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/03/20/setting-parameters-with-the-same-name-using-urlvariables/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 12:34:54 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[parameters]]></category>
		<category><![CDATA[URLVariables]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=77</guid>
		<description><![CDATA[The ability to set and send form parameters with the same name is available with URLVariables though it's not quite documented very well (at all?). Below are 4 examples of setting 2 values with same parameter name. The first example results in 1 parameter. The rest result in 2 parameters as expected. &#160; // results [...]]]></description>
			<content:encoded><![CDATA[<p>The ability to set and send form parameters with the same name is available with URLVariables though it's not quite documented very well (at all?).</p>
<p>Below are 4 examples of setting 2 values with same parameter name. The first example results in 1 parameter. The rest result in 2 parameters as expected.</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #009900;">// results in 1 parameter</span>
<span style="color: #6699cc; font-weight: bold;">var</span> urlVarsA<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
urlVarsA<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;foo&quot;</span><span style="color: #000000;">&#93;</span> = <span style="color: #990000;">&quot;Hello&quot;</span>;
urlVarsA<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;foo&quot;</span><span style="color: #000000;">&#93;</span> = <span style="color: #990000;">&quot;World!&quot;</span>; <span style="color: #009900;">// this overwrites the previous</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>urlVarsA<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// foo=World%21</span>
&nbsp;
<span style="color: #009900;">// results in 2 parameters as expected</span>
<span style="color: #6699cc; font-weight: bold;">var</span> urlVarsB<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
urlVarsB.<span style="color: #004993;">decode</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;foo=Hello&quot;</span><span style="color: #000000;">&#41;</span>;
urlVarsB.<span style="color: #004993;">decode</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;foo=World!&quot;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// decode() has logic to detect existing params</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>urlVarsB<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// foo=Hello&amp;foo=World%21</span>
&nbsp;
<span style="color: #009900;">// results in 2 parameters as expected</span>
<span style="color: #6699cc; font-weight: bold;">var</span> urlVarsC<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;foo=Hello&amp;foo=World!&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>urlVarsC<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// foo=Hello&amp;foo=World%21</span>
&nbsp;
<span style="color: #009900;">// results in 2 parameters as expected</span>
<span style="color: #6699cc; font-weight: bold;">var</span> urlVarsD<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=urlvariables%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:urlvariables.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">URLVariables</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
urlVarsD<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;foo&quot;</span><span style="color: #000000;">&#93;</span> = <span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;Hello&quot;</span>, <span style="color: #990000;">&quot;World!&quot;</span><span style="color: #000000;">&#93;</span>; <span style="color: #009900;">// Arrays are special to URLVariables</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>urlVarsD<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// foo=Hello&amp;foo=World%21</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/03/20/setting-parameters-with-the-same-name-using-urlvariables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building a Facebook application with Ribbit and Flash</title>
		<link>http://www.themorphicgroup.com/blog/2009/02/18/building-a-facebook-application-with-ribbit-and-flash/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/02/18/building-a-facebook-application-with-ribbit-and-flash/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 17:47:19 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[flash cs3]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Ribbit]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=73</guid>
		<description><![CDATA[For me, Facebook (free-access social networking website) is a guilty pleasure. I've spent more time on this site than I care to admit. When the chance came, I set out to use my mighty morphic skills to build a Facebook application. My goal was to create an application that makes phone calls from within Facebook. [...]]]></description>
			<content:encoded><![CDATA[<p>For me, Facebook (free-access social networking website) is a guilty pleasure. I've spent more time on this site than I care to admit. When the chance came, I set out to use my mighty morphic skills to build a Facebook application. My goal was to create an application that makes phone calls from within Facebook. I had a little help by using Ribbit as my co-pilot.</p>
<p>What is <a href="http://www.ribbit.com/" target="_blank">Ribbit</a>? It is an application framework that allows you to interact with telephone networks. You can basically send text message and make phone calls to mobile and regular phones. Right now, you can a request <a href="http://www.ribbit.com/reserve.php" target="_blank">Ribbit account</a> to use applications that utilize this platform. The Ribbit legal info can be found <a href="http://www.ribbit.com/legal/" target="_blank">here</a>. (For this blog, I am going to assume that you are a developer who is or will be using this platform for your application. You can get an account <a href="http://developer.ribbit.com/register" target="_blank">here</a>.)  </p>
<p>The concept was straight forward. Display my friends and create a phone book by adding their phone number, and call them up through the main application swf. My application uses Flash, Javascript, PHP, Ribbit Framework, Facebook API, and MySql database. I will primarily discuss the Facebook API FBML (Facebook Markup Language) with PHP, and how I used the Ribbit API in Flash.</p>
<p>First, it is a good idea to get acquainted with Facebook API by review and/or creating sample Facebook applications. You first need to look over at the <a href="http://developers.facebook.com/get_started.php" target="_blank">developer section</a>. As it states, you should be familiar with HTML, scripting languages such as PHP and JavaScript and a database like MySQL (if you want to contain any application state). You will be essentially hosting your application and interfacing with the Facebook site via their interface and setup. View the <a href="http://wiki.developers.facebook.com/index.php/Random_questions#Basic_Application_Architecture" target="_blank">Basic Application Architecture</a> to get an idea of how the system works. It is also helpful to run through their sample applications to understand what you can and can't do. <a href="http://wiki.developers.facebook.com/index.php/Demos" target="_blank">Demo Applications</a></p>
<p>Here are a few good links I found helpful:<br />
- <a href="http://wiki.developers.facebook.com/index.php/Creating_Your_First_Application" target="_blank">Creating your first application</a><br />
- <a href="http://wiki.developers.facebook.com/index.php/Main_Page" target="_blank">Developers Wiki Page</a><br />
- <a href="http://www.sitepoint.com/article/developing-facebook-platform/" target="_blank">Developing with the Facebook Platform and PHP</a><br />
- <a href="http://wiki.developers.facebook.com/index.php/FBML" target="_blank">FBML Reference</a><br />
- <a href="http://developers.facebook.com/tools.php" target="_blank">Test data retrieval of Platform</a><br />
- <a href="http://svn.facebook.com/svnroot/platform/clients/packages/facebook-platform.tar.gz" target="_blank">PHP Client files for Facebook integration</a></p>
<p>You can either build your application using FBML (self defined markup language) or in an external web site with an iframe. For my application I used FBML. There are some HTML and Javascript techniques that will not work well with FBML. The parsing of the markup causes issues when you use quotes or parenthesis in a particular ways. It is a matter of trial and error (Error 500 to be exact).</p>
<p>Here are some tips:<br />
- Avoid using inline Javascript, use function calls.<br />
- Use a tool like Firebug to debug Javascript.<br />
- I would also suggest enabling PHP log errors on your hosting server to troubleshoot issues cause on the server-end.<br />
- Remember that the tags need to be written well formed. You must make sure you close tags.<br />
- When you set up your application in the <a href="http://www.facebook.com/developers/" target="_blank">developer page</a>, make sure that the canvas url is all in lower-case.<br />
All in all, I always found a solution that would work. So don't give up.</p>
<p>FBML has tags for rendering flash and javascript bridge embed code. From the documentation, this tag (Fb:fbjs-bridge) seems to be fairly new. There must have been a big request for this feature because the rendered html in the FB:swf has allowScriptAccess set to none.  As the documentation states "Facebook prevents direct script access from flash"(1). The Javascript bridge is essential for interaction with the flash swf.<br />
- <a href="http://www2.themorphicgroup.com/projects/examples/FBJS/FBJS_flash.zip" target="_blank">code sample including javascript, php library and fla</a><br />
- <a href="http://wiki.developers.facebook.com/index.php/Fb:swf" target="_blank">info on FB:swf</a> (1)<br />
- <a href="http://wiki.developers.facebook.com/index.php/Fb:fbjs-bridge" target="_blank">info on Fb:fbjs-bridge</a></p>
<p>Make sure that you add this file at the root of your web domain to prevent security issues:<br />
...<br />
&lt;?xml version="1.0"?&gt;<br />
&lt;cross-domain-policy&gt;<br />
&lt;allow-access-from domain="apps.facebook.com" /&gt;<br />
&lt;allow-access-from domain="apps.*.facebook.com" /&gt;<br />
&lt;/cross-domain-policy&gt;<br />
...</p>
<p>Now that we have the basics down on setting up the application for Facebook, I will give a few highlights of my application (Call a Friend). I won't go through the setup and actions (update, select and insert query) of the database and html form.</p>
<p><img src="http://www2.themorphicgroup.com/projects/examples/FBJS/facebook_friendList.jpg" alt="Screen shot of Friend list" width="375" height="468" /></p>
<p>- To display all my friends, I reference get_friends() method from my instance of the Application API and run through the array object returned.<br />
Something like this:<br />
php<br />
....<br />
foreach($fb_friends as $friend){<br />
$fbml .= '&lt;div style="clear: both; padding: 3px;" &gt;'<br />
.   '&lt;fb:profile-pic  uid="' . $friend . '" size="square"/&gt; '<br />
.   '&lt;div height="20"&gt;&lt;fb:name  uid="' . $friend . '" capitalize="true"/&gt;&lt;/div&gt;'<br />
}<br />
echo $fbml;<br />
....</p>
<p>- Within that listing of friends, I make a call to a Javascript function to send up the phone number<br />
Something like this:<br />
php<br />
...<br />
$info = '555-555-5555';<br />
$fbml .= "&lt;input type='button' name='callButton' value='Call Friend' onClick=callFriendPhone('" . $info . "') /&gt; ";<br />
echo $fbml;<br />
...</p>
<p>html<br />
...<br />
&lt;fb:fbjs_bridge /&gt;<br />
&lt;div id="swfContainer"&gt;&lt;/div&gt;<br />
...</p>
<p>javascript<br />
...<br />
var swf = document.createElement('fb:swf');<br />
swf.setId('my_swf_id');<br />
swf.setWidth('200');<br />
swf.setHeight('100');<br />
swf.setSWFSrc('[absolute path]fbjs.swf');<br />
document.getElementById('swfContainer').appendChild(swf);<br />
function callFriendPhone(phone){<br />
document.getElementById('my_swf_id').callSWF('callFriend', phone);<br />
}<br />
...</p>
<p>So just to explain the Javascript... I'm getting the reference of the swf tag container. Which calls the internal actionscript method callFriend() with parameter (phone number). Make sure that the fb:fbjs_bridge tag is included on the page. Notice that the fb:swf tag is created dynamically and added to a div section. Check out my <a href="http://www2.themorphicgroup.com/projects/examples/FBJS/FBJS_flash.zip" target="_blank">code sample</a> as an example of this functionality.</p>
<p>This is a good time to talk about the embedded Flash Application which interacts with Ribbit. Before hand, I created a developer account on <a href="http://developer.ribbit.com" target="_blank">http://developer.ribbit.com</a>. From there I downloaded the flash kit. Using Flash CS3 to build my swf, I referenced the classes for Ribbit by adding the "RibbitAPI_2.5.0.1070.CS3" component into my library. If you haven't already, I would highly suggest playing around with the samples and reading the documentation on this site.</p>
<p>There are three parts to my application:<br />
<img src="http://www2.themorphicgroup.com/projects/examples/FBJS/flash_login.jpg" alt="login interface" /><br />
The login window allows the user to login with their username and password.</p>
<p><img src="http://www2.themorphicgroup.com/projects/examples/FBJS/flash_phone.jpg" alt="phone interface" /><br />
The phone interface contains the status, phone number input, volume control of mic and sound, and digit buttons. This interface references a local connection to the Javascript/Flash bridge.</p>
<p><img src="http://www2.themorphicgroup.com/projects/examples/FBJS/flash_callLog.jpg" alt="call logs interface" /><br />
Lastly, the call log interface displays data grid consisting of recent calls.</p>
<p>These parts interact with my service manager that holds the Ribbit Framework reference. It's main purpose is to pass the application and developer id to the service, log into the service and add event listeners to Ribbit's AuthenticationEvent and Ribbit Callmanager's CallEvent. After logging into the Ribbit service, I reference Ribbit's callManager object to make and end phone calls. This object is also used to get call logs to display all recent calls made with this account and reference the call state ( Ringing, Answered, etc.). <a href="http://www2.themorphicgroup.com/projects/examples/FBJS/RibbitServiceManager.as" target="_blank">View Source of RibbitServiceManager.as</a></p>
<p>All in all, the Ribbit framework was straight forward and easy to use. The developer site gives a lot of helpful information on getting your application up and running. The only drawback I had was that I could not allow users to log out. I'm getting this error: "TypeError: Error #1009: Cannot access a property or method of a null object reference." within the Ribbit API. There seems to be a problem with the current library component. Here are a few forum posting that I found <a href="http://developer.ribbit.com/forums/viewtopic.php?t=282&amp;highlight=typeerror+error+1009+cannot+access+property++method+null+object+reference" target="_blank">Forum post 1</a> <a href="http://developer.ribbit.com/forums/viewtopic.php?t=305&amp;highlight=typeerror+error+1009+cannot+access+property++method+null+object+reference" target="_blank">Forum post 2</a> .<a href="http://developer.ribbit.com/forums/viewtopic.php?t=305&amp;highlight=typeerror+error+1009+cannot+access+property++method+null+object+reference" target="_blank"><br />
</a></p>
<p>Maybe I'm getting this error because I'm not using their visual components. My colleague Seth is building a cool Ribbit app in Flex. I don't think he is having the same problem that I have. For now, I've disabled this feature in my application.</p>
<p>Well... I had a lot of fun building this application. If you have Facebook and want to check it out, hit this link : <a href="http://apps.facebook.com/callafriend/" target="_blank">http://apps.facebook.com/callafriend/</a></p>
<p>This application is still a beta. It will only be used as a demo. It may be changed or reset at any given time.</p>
<p>I welcome any feedback or comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/02/18/building-a-facebook-application-with-ribbit-and-flash/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>FABridge Error: &#8220;You are trying to call recursively into the Flash Player which is not allowed&#8230;&#8221;</title>
		<link>http://www.themorphicgroup.com/blog/2009/02/14/fabridge-error-you-are-trying-to-call-recursively-into-the-flash-player-which-is-not-allowed/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/02/14/fabridge-error-you-are-trying-to-call-recursively-into-the-flash-player-which-is-not-allowed/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 22:06:10 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[FABridge EventsToCallLater MethodsToCallLater]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=71</guid>
		<description><![CDATA[Like many people, I've been using the FABridge a lot and loving the simplicity it provides. Also like many people I've run into the following JavaScript error thrown by the FABridge:  You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used [...]]]></description>
			<content:encoded><![CDATA[<p>Like many people, I've been using the FABridge a lot and loving the simplicity it provides. Also like many people I've run into the following JavaScript error thrown by the FABridge: </p>
<blockquote><p><em>You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.</em></p></blockquote>
<p>In a pinch, I've worked around this error using the suggested JS setTimeout() function or by retrieving data by other means. I've finally decided to see if there was a better way and found one.</p>
<p><span style="color: #808080;">For the impatient (like myself), the solution is to use the following FABridge static constants: </span></p>
<blockquote>
<pre><span style="font-family: 'Courier New'; line-height: 18px; white-space: pre; "><span style="color: #808080;">FABridge.EventsToCallLater
FABridge.MethodsToCallLater </span></span></pre>
</blockquote>
<p>Let's look at a test project:</p>
<ul>
<li><a title="FABridge Test" href="http://www2.themorphicgroup.com/projects/examples/fabridgetest/" target="_blank">FABridge Test</a></li>
<li><a title="FABridge Test Source View" href="http://www2.themorphicgroup.com/projects/examples/fabridgetest/srcview/" target="_blank">FABridge Test Source View</a></li>
</ul>
<p>Open the FABridge Test and you'll see a bunch of links. Click <strong>FireBugLite</strong> to open a console. Then click <strong>embedSwf()</strong> to embed the swf which will output to the console when the FABridge has initialized (see the JavaScript callback() method on the HTML page . You should then see the following in the console:</p>
<blockquote>
<pre>
<div class="logRow">embedSwf
franky.name: franky
franky.children.length: <span class="objectBox-number">2
franky.children[0]: <span class="objectBox-object">Object
franky.children[0].name: john</span></span></div>
</pre>
</blockquote>
<p>The JS callback() method is a simple demonstration of getting data from the SWF through the FABridge.  Now click on the <strong>requestRingo()</strong> link.  That calls the following JS code:</p>
<blockquote>
<pre>getRoot().requestRingo();</pre>
</blockquote>
<p>That in turn calls the following ActionScipt code in FABridgetTest.as which dispatches a ringoRequested event:</p>
<blockquote>
<pre>public function requestRingo():void {
    var e:NodeEvent = new NodeEvent("ringoRequested");
     e.node = new Node("ringo", 14);
     e.node.children.push(new Node("dingo", 2));
     dispatchEvent(e); // dispatch right away
}</pre>
</blockquote>
<p>In the JavaScript, we've added an event listener for that event in the callback() method. The JS requestRingoHandler() method is called as a result:</p>
<blockquote>
<pre>function requestRingoHandler(event) {
    console.log("ringo");
      try {
         var ringo = event.getNode();
         console.log("ringo.name:", ringo.getName());
         console.log("ringo.children[0].name:", ringo.getChildren()[0].getName());
    } catch (e) {
        console.log("error:", e.message);
    }
}</pre>
</blockquote>
<p>So we've click on the <strong>requestRingo()</strong> link and will get the following output in the console:</p>
<blockquote>
<pre>ringo
error: You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.</pre>
</blockquote>
<div class="logRow">The error occurred because in requestRingoHandler(), we're accessing properties of the given event object and in this case the event was dispatched immediately when calling the AS requestRingo() method. We could avoid the error by dispatching the event after a delay. A more general solution would better of course. So now click on the <strong>setEventsToCallLater("fabridgetest::NodeEvent")</strong> link. Click on <strong>requestRingo()</strong> again and you'll get the following output:</div>
<div class="logRow">
<blockquote>
<pre>
<div class="logRow">ringo
ringo.name: ringo
ringo.children[0].name: dingo</div>
</pre>
</blockquote>
</div>
<p>The setEventsToCallLater() method registered the fabridgetest::NodeEvent class with the FABridge as an event to dispatch after a delay. This registration is done using the FABridge.EventsToCallLater Object constant. In a normal application you'd hard code these registrations, e.g.</p>
<blockquote>
<pre>FABridge.EventsToCallLater["fabridgetest::NodeEvent"] = "true";</pre>
</blockquote>
<p>You can also register the general flash.events.::Event class to cover all cases, but there may be performance concerns so that will have to be tested before I use it in production code.  </p>
<p>In addition to the EventsToCallLater constant, FABridge has the MethodsToCallLater constant which is the same thing but for specified methods for classes. The FABridge registers the following automatically:</p>
<blockquote>
<pre>MethodsToCallLater["mx.collections::ArrayCollection"]="refresh,removeItemAt";</pre>
</blockquote>
<p>Between EventsToCallLater and MethodsToCallLater you should be able to avoid many of the "<em>You are trying to call recursively into the Flash Player...</em>" errors.</p>
<p>Have you successfully uses these constants? Are there any pitfalls and/or performance issues?</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/02/14/fabridge-error-you-are-trying-to-call-recursively-into-the-flash-player-which-is-not-allowed/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mysterious Default XML Namespace Issue</title>
		<link>http://www.themorphicgroup.com/blog/2009/02/09/mysterious-default-xml-namespace-issue/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/02/09/mysterious-default-xml-namespace-issue/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 03:19:56 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[default xml namespace]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=70</guid>
		<description><![CDATA[I've been working with a RESTful service layer a lot recently that uses XML with a default namespace. In an ActionScript library project I have some delegate and model classes that natually use the default xml namespace directive. Once in a while I ran into a mysterious issue where the namespace doesn't seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>I've been working with a RESTful service layer a lot recently that uses XML with a default namespace. In an ActionScript library project I have some delegate and model classes that natually use the default xml namespace directive. Once in a while I ran into a mysterious issue where the namespace doesn't seem to be applied, causing my XPath expressions to not find the values that are right there staring at me. When I stepped through the code I was able to see and trace out the complete XML value.  I was baffled and found myself in a tailspin of trying random things to solve the issue. It turned out that all I needed to do was clean the projects (duh).  I suspect that there's a small Flex compiler issue that messes with the application of namespaces. I'm curious if anyone else has had this issue and/or has a better explanation. If you've had this or a similar sounding issue, remember that it may not always be the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/02/09/mysterious-default-xml-namespace-issue/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</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>Unknown Morphician</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 "the Happening" that was Adobe Max 2008, my first Max. For the most part I was impressed with this, [...]]]></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 "the Happening" 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'm missing out on new and exciting features. Call it the rabid consumer in me. Like all the conventions I'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'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> -  "to be or not to be" 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 "al a carte" 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/" 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/" 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... What I got out of this session- I'm interested in building an Air Application using this library verses MapQuest's library.</p>
<p><strong>Adobe XDCE - Air User Experience Mode</strong>l - Demos on Aggregators, Utilities, Media Consumers... 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" 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/" 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" 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>
		<slash:comments>0</slash:comments>
		</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>Unknown Morphician</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've been using both ServiceCapture and Fiddler for a while now to debug HTTP traffic from web applications (I'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've been using both <a href="http://kevinlangdon.com/serviceCapture/">ServiceCapture</a> and <a href="http://www.fiddlertool.com/fiddler/">Fiddler</a> for a while now to debug HTTP traffic from web applications (I'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">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 "none - Standard" 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 "none - Standard" essentially turns off ConnSets. If you've changed your network settings and then choose "none - Standard" it does not reset your settings to the default "Direct connection to the Internet". Create a default setting and use that instead of "none - Standard".</p>
<ol>
<li>Go to: Tools &gt; Options &gt; Advanced &gt; Network</li>
<li style="text-align: left;">Select "Direct connection to the Internet:"</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 "default" for the key in the dialog and click OK</li>
<li style="text-align: left;">Enter any value for the location (default = "Location") 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 "Automatic proxy configuration URL:"</li>
<li style="text-align: left;">Enter "file:///C:/Program%20Files/ServiceCapture/firefox.js"</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 "ServiceCapture" for the key in the dialog and click OK</li>
<li style="text-align: left;">Enter a value for the location (default = "Location") 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 "Manual proxy configuration URL:"</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 "Fiddler" for the key in the dialog and click OK</li>
<li style="text-align: left;">Enter a value for the location (default = "Location") 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>
		<slash:comments>3</slash:comments>
		</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>Unknown Morphician</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'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 [...]]]></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'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 '[class package]' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. [class pointing to library symbol]</li>
</ul>
<p>Of course we couldn'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/">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'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'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'm not surprised that I couldn't find much information on this bug because most people who version control larger Flash projects are likely using Flex Builder.</p>
<p>I've submitted a bug to Adobe but hope there'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>
		<slash:comments>3</slash:comments>
		</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>Unknown Morphician</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's post about anonymous functions from externalinterface, here'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) { property = ExternalInterface.call("function() { return " + name +"; }"); } else { property [...]]]></description>
			<content:encoded><![CDATA[<p>Jumping off of Joey's post about <a href="http://www.themorphicgroup.com/blog/2008/06/05/anonymous-functions-from-externalinterface/">anonymous functions from externalinterface</a>, here'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...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/07/23/dynamically-getting-javascript-properties/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</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's definitely not _new_ news on account of I learned about it from Theo Hultberg'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'll post it just in case someone else doesn't know this. You can write unit [...]]]></description>
			<content:encoded><![CDATA[<p>This is probably not news. In fact, it's definitely not _new_ news on account of I learned about it from Theo Hultberg'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'll post it just in case someone else doesn'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'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'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 "there must be a better way to write these tests." It was only then that I ran a Google search and read Theo's blog post.</p>
<p>Although Theo's blog post describes how you can alternately write FlexUnit tests I'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's constructor accepts a string parameter naming the test method to run. This is the approach that Darron writes about. It'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 "test". I'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 "test".</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="testRunner" width="100%" height="100%" /&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 "test".<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'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, "Value 1");
		}

		public function testB():void {
			assertEquals(_example.b, "Value 2");
		}

	}
}
</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>
		<slash:comments>2</slash:comments>
		</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>Unknown Morphician</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("cuePoint", 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>
		<slash:comments>0</slash:comments>
		</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'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'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'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'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'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'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'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'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'm using follows. Note that we'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'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 = "_" + (new Date()).getTime();</li>
<li>Then sending.swf calls send("_defaultConnection", "setNewConnectionName", 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>
		<slash:comments>2</slash:comments>
		</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 "issue" regarding displaying content at 100% height. I'm just posting a reminder, and a Flex and SWFObject-specific version. </p>
<p>The "issue" is that in most cases you probably won'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've forgotten about this issue we're likely to wonder why we don't see the Flex application at all in Firefox. The reason is that Firefox is (apparently, from what I'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's container. This is the important part. If the container of the object doesn't have enough actual height then the content for which you'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't correctly configured the containers to have enough height we won'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'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;--&gt;
          &lt;object type="application/x-shockwave-flash" data="example.swf"
               width="100%" height="100%"&gt;
        &lt;!--&lt;![endif]--&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;!--[if !IE]&gt;--&gt;
          &lt;/object&gt;
        &lt;!--&lt;![endif]--&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>
		<slash:comments>2</slash:comments>
		</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>Unknown Morphician</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, I [...]]]></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're new to Programmatic Skinning, check out Joey Lott and Chafic Kazoun'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 = "dynamic text"; // example - Button.Data property
           var _textFormat:TextFormat = new TextFormat();
           _textFormat.font = "FranklinMed";
           _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>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Log From Flash or Flex to Firebug</title>
		<link>http://www.themorphicgroup.com/blog/2008/05/23/log-from-flash-or-flex-to-firebug/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/05/23/log-from-flash-or-flex-to-firebug/#comments</comments>
		<pubDate>Fri, 23 May 2008 20:11:41 +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=16</guid>
		<description><![CDATA[I only just recently started using Firebug (www.getfirebug.com.) It seems it's a popular way to debug JavaScript and HTML in Firefox. I use Firefox as my preferred browser, but working with Flex and Flash I rarely have to debug HTML or JavaScript. However, I was recently working on a project that required integrating ActionScript with [...]]]></description>
			<content:encoded><![CDATA[<p>I only just recently started using Firebug (www.getfirebug.com.) It seems it's a popular way to debug JavaScript and HTML in Firefox. I use Firefox as my preferred browser, but working with Flex and Flash I rarely have to debug HTML or JavaScript. However, I was recently working on a project that required integrating ActionScript with a Move Networks media player, which requires a great deal of JavaScript. This gave me a reason to install Firebug, and I have to say that it's very cool. That's not really the point of this post, though. That's all just background information. Danny Patterson, a friend and colleague, recently blogged about how to log from Flex or Flash to Firebug. You can read the <a title="post" href="http://blog.dannypatterson.com/?p=144" target="_blank">post </a>on his blog. Basically, Firebug has a JavaScript API that you can call using ExternalInterface. For example, calling ExternalInterface.call("console.debug", "message from Flex"); will write a message to Firebug. Danny just put the ExternalInterface calls in a class that can be used with the Flex logging framework.  Very neat.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/05/23/log-from-flash-or-flex-to-firebug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using FlexBuilder 3 to debug &amp; edit Flash CS3 projects</title>
		<link>http://www.themorphicgroup.com/blog/2008/05/16/10/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/05/16/10/#comments</comments>
		<pubDate>Fri, 16 May 2008 19:00:40 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[debugger]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[edit]]></category>
		<category><![CDATA[flash cs3]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[FlexBuilder]]></category>
		<category><![CDATA[hello world]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=10</guid>
		<description><![CDATA[Recently I was working on a project that due to a requirement had to be compiled in Flash CS3. Having spent the last few years exclusively using FlexBuilder I was shocked at the HORRIBLE AS3 editor and debugger in Flash CS3. I quickly tried to figure out how to edit and debug from FlexBuilder 3. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was working on a project that due to a requirement had to be compiled in Flash CS3.  Having spent the last few years exclusively using FlexBuilder I was shocked at the HORRIBLE AS3 editor and debugger in Flash CS3.  I quickly tried to figure out how to edit and debug from FlexBuilder 3.  I got some help along the way, and wanted to share the process.</p>
<p>Step 1: (FB3) Create a new ActionScript project in Flex Builder 3 and give it a name.</p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/new_as3_project.gif" border="0" alt="Photobucket" /></p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/name_as3_project.gif" border="0" alt="Photobucket" /></p>
<p>Step 2: (Flash CS3) Make a new Flash CS3 project, save it in the SAME DIRECTORY as the AS3 project.</p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/new_cs3_project.gif" border="0" alt="Photobucket" /></p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/name_cs3_project.gif" border="0" alt="Photobucket" /></p>
<p>Step 3: (Flash CS3) Open up File --&gt; Publish Settings in your Flash CS3 project and select "Permit debugging".</p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/permit_debuging.gif" border="0" alt="Photobucket" /></p>
<p>Step 4: (Flash CS3) Click on the Settings button and enter the name of your main AS3 class.  If your main AS3 class is not in the same directory as the FLA then add the directory as a Classplath.  Click the green check mark to validate the class location.</p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/document_class.gif" border="0" alt="Photobucket" /></p>
<p>Step 5: (FB3) Write a bit of code and put in a break point.</p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/write_code.gif" border="0" alt="Photobucket" /></p>
<p>Step 6: (Flash CS3) Compile a debug version of the SWF.  The breakpoint you entered in FB3 will be compiled into the SWF.  After it compiles and opens in the Flash CS3 debugger just close it.  The SWF should have been compiled into the root of your FB3 project.  I had to quit FB3 and reopen it for the SWF to show up.</p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/debug_movie.gif" border="0" alt="Photobucket" /></p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/swf_in_fb_project.gif" border="0" alt="Photobucket" /></p>
<p>Step 7: (FB3) Make a new debugging profile that points directly to the Flash CS3 complied SWF (NOT THE FB3 SWF in the bin directory).</p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/new_debug_profile.gif" border="0" alt="Photobucket" /></p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/new_debug_profile_2.gif" border="0" alt="Photobucket" /></p>
<p>Step 8: (FB3) Debug with your new profile.</p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/debug_it.gif" border="0" alt="Photobucket" /></p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/debug_working.gif" border="0" alt="Photobucket" /></p>
<p>If the debugger times-out and does not connect you may need to configure the debugger setting in your Flash Player.  Do this by rt-clicking on the SWF and selecting Debugger.</p>
<p><img src="http://i162.photobucket.com/albums/t253/jayfour000/flash_debugger.gif" border="0" alt="Photobucket" /></p>
<p>This workflow allows for you to use the code hinting and debugger in FlexBuilder 3 even when compiling in Flash CS3.  Let me know if you run into any problems.</p>
<p>Special thanks to Melih Elibol who helped me with some of these steps :).</p>
<p>--jason</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/05/16/10/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
