<?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; Technology</title>
	<atom:link href="http://www.themorphicgroup.com/blog/category/technology/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>Flex 4 Custom Preloader</title>
		<link>http://www.themorphicgroup.com/blog/2009/11/11/flex-4-custom-preloader/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/11/11/flex-4-custom-preloader/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 18:10:07 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[flex 4]]></category>
		<category><![CDATA[preloader]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=340</guid>
		<description><![CDATA[In this example were going to look at a way to create a custom preloader SWC in Flash Professional and use it inside of a Flex 4 application by extending the SparkDownloadProgressBar class. This preloader will display the progress percentage of loading and also a count of RSLs as they are being loaded, after loading [...]]]></description>
			<content:encoded><![CDATA[<p>
In this example were going to look at a way to create a custom preloader SWC in Flash Professional and use it inside of a Flex 4 application by extending the SparkDownloadProgressBar class.<br />
<br />
This preloader will display the progress percentage of loading and also a count of RSLs as they are being loaded, after loading is complete the progress of initialization will be displayed. Both of the progresses will be displayed by a graphical progress bar and in text.
</p>
<p>
	<a href="http://www.themorphicgroup.com/examples/Flex4PreloaderExample/Flex4PreloaderExample.html" target="_blank"><strong>View Demo Preloader App</strong> (right click for source view)</a>
</p>
<p>
	The preloader may fly by, so lets first take a look at how this progress bar looks as it is loading the Flex app:<br />
	<br/><br />
	<img src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/11/flex4_preloader01.png" width="331" height="171" alt="flex 4 preloader" />
</p>
<p>
	The next screenshot shows the progress as RSLs are being loaded:<br />
	<br/><br />
	<img src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/11/flex4_preloader02.png" width="331" height="171" alt="flex 4 preloader" />
</p>
<p>
	Finally the progress of initialization, with a second progress bar:<br />
	<br/><br />
	<img src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/11/flex4_preloader03.png" width="331" height="171" alt="flex 4 preloader" />
</p>
<h2>Creating the Preloader SWC in Flash Pro</h2>
<p>
	In Flash professional we create a custom preloader. In this example there are several layers which the design is created from.<br />
	The layer 'prog_bar' and 'initilize_bar" hold shapes that we will use to resize to show progress.<br />
	The 'loading text' layer contains some dynamic text that has Character Embedding for upper/lower/numbers.<br />
	The layers look like this:
</p>
<p><img src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/11/flex4_preloader_flash.png" width="218" height="159" alt="flex 4 preloader" /></p>
<p>
	The custom preloader FLA can be found in the example by viewing source.
</p>
<p>
	The FLA preloader is a movie clip and its properties are set for &quot;Export for ActioScript&quot; the &quot;Class&quot; property is set to &quot;PreloaderDisplay&quot; this allows us to have a PreloaderDisplay.swc created when this FLA is published.
</p>
<p><a href="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/11/flex4_preloader_flash_prop_large.png"><img src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/11/flex4_preloader_flash_prop_small.png" width="230" height="148" alt="flex 4 preloader" border="none" /></a></p>
<p>
	In the first frame of the FLA &quot;actions&quot; layer we create the functions to set the two different progress bars:
</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #009900;">//reset</span>
setMainProgress<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>;
setInitalizeProgress<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>;
loading_txt.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;&quot;</span>;
&nbsp;
<span style="color: #009900;">//function for setting main prgress bar</span>
<span style="color: #339966; font-weight: bold;">function</span> setMainProgress<span style="color: #000000;">&#40;</span>percent<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a><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>
	prog_bar.<span style="color: #004993;">width</span> = percent <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">275</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #009900;">//function for setting the initilize bar</span>
<span style="color: #339966; font-weight: bold;">function</span> setInitalizeProgress<span style="color: #000000;">&#40;</span>percent<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a><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>
	initialize_bar.<span style="color: #004993;">width</span> = percent <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight:bold;">275</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>
	The final step is to &quot;Publish&quot; the FLA so that the SWC file is create, this SWC will be used in Flash Builder.
</p>
<h2>Creating the Custom Preloader in Flex 4</h2>
<p>
	The first step is to place the PreloaderDisplay.swc in the &quot;libs&quot; folder, this will make the PreloaderDisplay and its methods available to Flex:
</p>
<p><img src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/11/flex4_preloader_libs.png" width="189" height="55" alt="preloader swc libs" /></p>
<p>
	To define a custom preloader we will do this in the Flex application's Application file, we simply specify the preloader class:
</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>Application preloader=<span style="color: #990000;">&quot;com.themorphicgroup.preload.Preloader&quot;</span> ...
&nbsp;</pre>
<p>
	In the Preloader class we will extend &quot;SparkDownloadProgressBar&quot;.</p>
<p>	The SparkDownloadProgressBar class displays download progress. </p>
<p>	From Flex 4 docs: It is used by the Preloader control to provide user feedback while the application is downloading and loading.<br />
	The download progress bar displays information about two different phases of the application: the download phase and the initialization phase.
</p>
<p>
	The Preloader.as extends &quot;SparkDownloadProgressBar&quot; and we will use the FLA PreloaderDisplay.swc by creating a variable called &quot;preloaderDisplay&quot;:
</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Preloader extends SparkDownloadProgressBar <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> preloaderDisplay<span style="color: #000000; font-weight: bold;">:</span>PreloaderDisplay;
	...
&nbsp;</pre>
<p>
	To add the PreloaderDisplay we will override the SparkDownloadProgressBar's &quot;createChildren&quot; method, in this method we will create a new PreloaderDisplay and<br />
	use the &quot;addChild&quot; method (SparkDownloadProgressBar inherits addChild from DisplayObjectContainer):
</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> createChildren<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: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>preloaderDisplay<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		preloaderDisplay = <span style="color: #0033ff; font-weight: bold;">new</span> PreloaderDisplay<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
		<span style="color: #6699cc; font-weight: bold;">var</span> startX<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a> = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Math</span></a>.<span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">stageWidth</span> <span style="color: #000000; font-weight: bold;">-</span> preloaderDisplay.<span style="color: #004993;">width</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #6699cc; font-weight: bold;">var</span> startY<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a> = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Math</span></a>.<span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">stageHeight</span> <span style="color: #000000; font-weight: bold;">-</span> preloaderDisplay.<span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
&nbsp;
		preloaderDisplay.<span style="color: #004993;">x</span> = startX;
		preloaderDisplay.<span style="color: #004993;">y</span> = startY;
		<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>preloaderDisplay<span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>
	There are several methods that we will override so that we can make updates to the PreloaderDisplay.swc.<br />
	The rslProgressHandler method will be called each time a RSL is being loaded. We will use this method to set text indicating the current count of RSL being loaded:
</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> rslBaseText<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;loading: &quot;</span>;
override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> rslProgressHandler<span style="color: #000000;">&#40;</span>evt<span style="color: #000000; font-weight: bold;">:</span>RSLEvent<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: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>evt.rslIndex <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> evt.rslTotal<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #009900;">//create text to track the RSLs being loaded</span>
		rslBaseText = <span style="color: #990000;">&quot;loading RSL &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> evt.rslIndex <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot; of &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> evt.rslTotal <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;: &quot;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>
	The next method we will override is setDownloadProgress. This method indicateds the current download progress. in this method we will set the<br />
	PreloaderDisplay.swc main progress bar and set the text:
</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> setDownloadProgress<span style="color: #000000;">&#40;</span>completed<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a>, total<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a><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: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>preloaderDisplay<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #009900;">//set the main progress bar inside PreloaderDisplay</span>
		preloaderDisplay.setMainProgress<span style="color: #000000;">&#40;</span>completed<span style="color: #000000; font-weight: bold;">/</span>total<span style="color: #000000;">&#41;</span>;
		<span style="color: #009900;">//set percetage text to display, if loading RSL the rslBaseText will indicate the number</span>
		setPreloaderLoadingText<span style="color: #000000;">&#40;</span>rslBaseText <span style="color: #000000; font-weight: bold;">+</span> <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Math</span></a>.<span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>completed<span style="color: #000000; font-weight: bold;">/</span>total<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span>.<span style="color: #004993;">toString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;%&quot;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>
	Finally we will look at overriding setInitProgress, this method indicates the progress of the Flex app as it initializes.<br />
	We will set the text in PreloaderDisplay.swc and change the progress of the second initialize progress bar:
</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> setInitProgress<span style="color: #000000;">&#40;</span>completed<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a>, total<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a><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: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>preloaderDisplay<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #009900;">//set the initialization progress bar inside PreloaderDisplay</span>
		preloaderDisplay.setInitalizeProgress<span style="color: #000000;">&#40;</span>completed<span style="color: #000000; font-weight: bold;">/</span>total<span style="color: #000000;">&#41;</span>;
		<span style="color: #009900;">//set loading text</span>
		<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>completed <span style="color: #000000; font-weight: bold;">&gt;</span> total<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
			setPreloaderLoadingText<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;almost done&quot;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
			setPreloaderLoadingText<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;initializing &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> completed <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot; of &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> total<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>&nbsp;</p>
<p>
	This blog entry does not cover every bit of code used in the preloader, so<br />
	<a href="http://www.themorphicgroup.com/examples/Flex4PreloaderExample/Flex4PreloaderExample.html" target="_blank"><strong>View Demo Preloader App</strong> right click for source view</a>
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/11/11/flex-4-custom-preloader/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<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>Example of Feature Rich Item Renderers in Flex 4</title>
		<link>http://www.themorphicgroup.com/blog/2009/10/15/example-of-feature-rich-item-renderers-in-flex-4/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/10/15/example-of-feature-rich-item-renderers-in-flex-4/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 15:27:15 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[flex4]]></category>
		<category><![CDATA[itemrenderer]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[Spark]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=306</guid>
		<description><![CDATA[This is an example of creating feature rich item renderers in Flex 4. The example retrieves this blog's RSS feed and displays each entry in a Spark List using Item Renderers. This example will demonstrate: Skinning an item renderer and list States in an item renderer Pass callback function to item renderer Override ItemRenderer 'set [...]]]></description>
			<content:encoded><![CDATA[<p>
This is an example of creating feature rich item renderers in Flex 4. The example retrieves this blog's RSS feed and displays each entry in a Spark List using Item Renderers. This example will demonstrate:</p>
<ul style="list-style:square">
<li>Skinning an item renderer and list</li>
<li>States in an item renderer</li>
<li>Pass callback function to item renderer</li>
<li>Override ItemRenderer 'set data'  as a known ValueObject</li>
<li>Swap icons/images based on data values</li>
</ul>
<p>
	<a href="http://www.themorphicgroup.com/examples/Flex4ItemRenderer01/Flex4ItemRenderer01.html" target="_blank"><img src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/10/itemrenderer_flex4_01_post.png" width="444" height="175" border="none" alt="" /></a><br />
	<br />
	&nbsp;<a href="http://www.themorphicgroup.com/examples/Flex4ItemRenderer01/Flex4ItemRenderer01.html" target="_blank"><strong>View the Example</strong> with source view enabled</a>
</p>
<p>	This blog post will cover the main points of the example but not the entire code, so view the example's source view to see all the code in full.</p>
<h3>Getting Blog Entries From RSS</h3>
<p>
	I won't go into too much detail about how the data is retrieved, view the source for all the details. The RSSService class makes a request to this blog's RSS url. That XML responce is turned into an ArrayCollection of BlogEntryVO value objects. The result ArrayCollection is set as the data provider for the Spark List.
</p>
<h3>Skinning the Spark List</h3>
<p>
	<strong>Spark List:</strong><br />
	The first step in skinning the Spark List is to define the 'skinClass':
</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>List id=<span style="color: #990000;">&quot;blogList&quot;</span>
	skinClass=<span style="color: #990000;">&quot;com.themorphicgroup.skins.list.ListSkin&quot;</span>
	<span style="color: #004993;">change</span>=<span style="color: #990000;">&quot;blogList_selectionHandler(event)&quot;</span>
	caretChange=<span style="color: #990000;">&quot;blogList_selectionHandler(event)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;</pre>
<p>
	<strong>Skinning Spark List:</strong><br />
	Lets look at the 'com.themorphicgroup.skins.list.ListSkin' List skin class. The most important parts of this skin is the 'Scroller' and 'DataGroup' it surrounds.<br />
	The DataGroup is a simple container class in Flex 4 for holding data items and item renderers. The Scroller enables the DataGroup items to be scrolled. Full List skin code:
</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>SparkSkin 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: #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>Metadata<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000;">&#91;</span>HostComponent<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;spark.components.List&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>fx<span style="color: #000000; font-weight: bold;">:</span>Metadata<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>states<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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;normal&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;over&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>states<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;!--</span> <span style="color: #004993;">background</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;">top</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">left</span>=<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>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;0x999999&quot;</span> weight=<span style="color: #990000;">&quot;2&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>SolidColor <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;0xffffff&quot;</span> <span style="color: #004993;">color</span>.over=<span style="color: #990000;">&quot;0xf8f8f8&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>Rect<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;!--</span> scroller <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>Scroller id=<span style="color: #990000;">&quot;scroller&quot;</span>
				<span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;0&quot;</span>
				<span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;0&quot;</span>
				<span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;0&quot;</span>
				<span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;0&quot;</span>
				horizontalScrollPolicy=<span style="color: #990000;">&quot;off&quot;</span>
				minViewportInset=<span style="color: #990000;">&quot;1&quot;</span>
				focusEnabled=<span style="color: #990000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;!--</span> container <span style="color: #0033ff; font-weight: bold;">for</span> data<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>DataGroup id=<span style="color: #990000;">&quot;dataGroup&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>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>VerticalLayout gap=<span style="color: #990000;">&quot;0&quot;</span> horizontalAlign=<span style="color: #990000;">&quot;contentJustify&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>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>DataGroup<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>Scroller<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>SparkSkin<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;</pre>
<p>
	<strong>Skinning Spark List and global vertical scrollers:</strong><br />
	The last thing we will look at in skinning the List is the skin for the Scroller (VScroll). The skin classes for the scroller are in com.themorphicgroup.skins.scroller.vertical<br />
	To define the 'VerticalScrollbar' Skin to all Spark VScrollBar we do that in the css file:
</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
s<span style="color: #000000; font-weight: bold;">|</span>VScrollBar <span style="color: #000000;">&#123;</span>
	skinClass<span style="color: #000000; font-weight: bold;">:</span> ClassReference<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;com.themorphicgroup.skins.scroller.vertical.VerticalScrollbar&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<h3>Define an ItemRenderer for the Spark List</h3>
<p>
	In creationComplete we will create the item renderer for the Spark List, we will also define any needed properties.<br />
	In this case we want to pass in a callback funtion for when the delete icon is clicked in an item renderer.
</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #009900;">//create itemrenderer</span>
<span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> application_creationCompleteHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span>FlexEvent<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: #009900;">//create itemrenderer</span>
	blogListItemRenderer = <span style="color: #0033ff; font-weight: bold;">new</span> ClassFactory<span style="color: #000000;">&#40;</span>BlogEntryItemRenderer<span style="color: #000000;">&#41;</span>;
	<span style="color: #009900;">//define properties (callback for item delete)</span>
	blogListItemRenderer.properties = <span style="color: #000000;">&#123;</span>deleteHandlerFunction<span style="color: #000000; font-weight: bold;">:</span>itemDeleteClick_handler<span style="color: #000000;">&#125;</span>;
	<span style="color: #009900;">//set itemrenderer to List</span>
	blogList.itemRenderer = blogListItemRenderer;
	.... <span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #009900;">//callback function for delete click</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> itemDeleteClick_handler<span style="color: #000000;">&#40;</span>blogEntryItem<span style="color: #000000; font-weight: bold;">:</span>BlogEntryVO<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>
	...
&nbsp;</pre>
<p>
Inside the Item Renderer when the delete icon is clicked the callback function is passed the current item renderer's data (a value object):
</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> deleteHandlerFunction<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=function%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:function.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Function</span></a>;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> trash_btn_clickHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">MouseEvent</span></a><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: #009900;">//callback function pass BlogEntryVO value object</span>
	deleteHandlerFunction<span style="color: #000000;">&#40;</span>blogEntry<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<h3>The ItemRenderer</h3>
<p>
	<strong>Setting data in the ItemRenderer: </strong><br />
	In the 'BlogEntryItemRenderer' we will override the the set data function and set a BlogEntryVO with the data of the item renderer:
</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> blogEntry<span style="color: #000000; font-weight: bold;">:</span>BlogEntryVO
&nbsp;
override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> <span style="color: #004993;">data</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Object</span></a><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: #0033ff; font-weight: bold;">super</span>.<span style="color: #004993;">data</span> = <span style="color: #004993;">value</span>;
	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span> <span style="color: #0033ff; font-weight: bold;">is</span> BlogEntryVO<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		blogEntry = BlogEntryVO<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;</pre>
<p>
	<strong>Displaying data in the ItemRenderer: </strong><br />
	To display the data values in the itemrenderer we will override updateDisplayList and set values to Labels etc:
</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> updateDisplayList<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a>, unscaledHeight<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a><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: #0033ff; font-weight: bold;">super</span>.updateDisplayList<span style="color: #000000;">&#40;</span>unscaledWidth,unscaledHeight<span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>title_lbl<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		title_lbl.<span style="color: #004993;">text</span> = blogEntry.title;
		...
&nbsp;</pre>
<h3>Skinning and States in the ItemRenderer</h3>
<p>
	To make the item renderer more attractive and interactive we will create some states. In Flex 4 you can specify not only the name of a state but a name that will define a group of states:
</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>states<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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;normal&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;hovered&quot;</span> stateGroups=<span style="color: #990000;">&quot;[hoveredStates]&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;selected&quot;</span> stateGroups=<span style="color: #990000;">&quot;[selectedStates]&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;normalAndShowsCaret&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;hoveredAndShowsCaret&quot;</span> stateGroups=<span style="color: #990000;">&quot;[hoveredStates]&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;selectedAndShowsCaret&quot;</span> stateGroups=<span style="color: #990000;">&quot;[selectedStates]&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>states<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;</pre>
<p>
	Having the state and stateGroups names means we can define properties for those states. For example with can set the alpha of the background color as <code>alpha='0'</code> and them the when we are in one of the hovered states as <code>alpha.hoveredStates='.1'</code>:
</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>Rect <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>
	<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>SolidColor <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;0x6699cc&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">alpha</span>.hoveredStates=<span style="color: #990000;">&quot;.1&quot;</span> <span style="color: #004993;">alpha</span>.selectedStates=<span style="color: #990000;">&quot;.25&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>Rect<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>Label id=<span style="color: #990000;">&quot;title_lbl&quot;</span>
		 maxDisplayedLines=<span style="color: #990000;">&quot;1&quot;</span>
		 styleName=<span style="color: #990000;">&quot;myriad&quot;</span>
		 <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;10&quot;</span>
		 <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;10&quot;</span>
		 <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;26&quot;</span>
		 textDecoration.hoveredStates=<span style="color: #990000;">&quot;underline&quot;</span>
		 fontWeight.selectedStates=<span style="color: #990000;">&quot;bold&quot;</span>
		 <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#000000&quot;</span>
		 <span style="color: #004993;">fontSize</span>=<span style="color: #990000;">&quot;14&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;</pre>
<h3>Summary</h3>
<p>
	This blog post does not cover every bit of code in the example so <a href="http://www.themorphicgroup.com/examples/Flex4ItemRenderer01/Flex4ItemRenderer01.html" target="_blank"><strong>View the Example</strong> with source view enabled</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/10/15/example-of-feature-rich-item-renderers-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Join TMG at cfdevcamp in San Francisco Nov. 7th</title>
		<link>http://www.themorphicgroup.com/blog/2009/10/12/cfdevcam/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/10/12/cfdevcam/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 18:37:40 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=292</guid>
		<description><![CDATA[Join The Morphic Group at cfdevcamp in San Francisco November 7th 2009. cfdevcamp is a gathering of people passionate about learning through  collaboration.  Attendees will work in small teams to code projects  ideas from the team members or from a suggested list of projects.   This will not be a lecture style event or a traditional [...]]]></description>
			<content:encoded><![CDATA[<p>Join The Morphic Group at <a href="http://www.cfdevcamp.org/">cfdevcamp</a> in San Francisco November 7th 2009.</p>
<p><img class="alignnone size-full wp-image-294" title="cfdevcamp-trans2" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/10/cfdevcamp-trans2.png" alt="cfdevcamp-trans2" width="250" height="55" /><br />
cfdevcamp is a gathering of people passionate about learning through  collaboration.  Attendees will work in small teams to code projects  ideas from the team members or from a suggested list of projects.   This will not be a lecture style event or a traditional classroom with  a set curriculum and learning materials.  We want you to ask questions, hack away and have fun.</p>
<p>This is a great event for ColdFusion beginners, experts, and everyone in between.</p>
<p>For more information and to sign up for this free event visit: <a href="http://www.cfdevcamp.org/">http://www.cfdevcamp.org/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/10/12/cfdevcam/feed/</wfw:commentRss>
		<slash:comments>0</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>More Memory for FlexBuilder</title>
		<link>http://www.themorphicgroup.com/blog/2009/08/14/more-memory-for-flexbuilder/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/08/14/more-memory-for-flexbuilder/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 13:37:56 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[edit]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[FlexBuilder]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[The Morphic Group]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=257</guid>
		<description><![CDATA[If you are like me and cannot stand long compile times you may find that increasing the memory allocation for FlexBuilder will help. To do this edit this file. Likewise, if FlexBuilder uses too much memory for your system you can make edits to this file. C:\Program Files\Adobe\Flex Builder 3\FlexBuilder.ini Here are my settings ### [...]]]></description>
			<content:encoded><![CDATA[<p>If you are like me and cannot stand long compile times you may find that increasing the memory allocation for FlexBuilder will help.  To do this edit this file.  Likewise, if FlexBuilder uses too much memory for your system you can make edits to this file.  </p>
<p>C:\Program Files\Adobe\Flex Builder 3\FlexBuilder.ini</p>
<p>Here are my settings<br />
###</p>
<p>-vmargs<br />
-Xms512m<br />
-Xmx1024m<br />
-XX:MaxPermSize=256m<br />
-XX:PermSize=64m<br />
-Djava.net.preferIPv4Stack=true</p>
<p>###<br />
-Xms512m (minimum memory allocated for FlexBuilder)<br />
-Xmx1024m (max memory cap for FlexBuilder)</p>
<p>If you happen to have 8GB of ram you might change your settings to this :).</p>
<p>-Xms512m<br />
-Xms4096m</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/08/14/more-memory-for-flexbuilder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dear Blog Reader&#8230;</title>
		<link>http://www.themorphicgroup.com/blog/2009/07/16/dear-blog-reader/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/07/16/dear-blog-reader/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 01:29:04 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Views]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=239</guid>
		<description><![CDATA[Hey there stranger. Is that a new T-shirt? We like it. It's clever. No really. We get it. You know what's funny? We were just thinking about the last time we saw you. Yeah, no kidding. It seems like yesterday. You came here thinking your day was a total wash. You were on the brink [...]]]></description>
			<content:encoded><![CDATA[<p>Hey there stranger. Is that a new T-shirt? We like it. It's clever. No really. We get it. You know what's funny? We were just thinking about the last time we saw you. Yeah, no kidding. It seems like yesterday. You came here thinking your day was a total wash. You were on the brink of going home, alone, empty handed, but fortune/Google smiled on you and introduced you to us.</p>
<p>We don't want to brag or anything but we know we showed you something you've never seen before. We bet you went and told all of your programmer friends about it. It's cool. We're proud of our talents. We're even cool with the fact that you probably went and told your boss you figured that problem out all by yourself. No, no, it's fine, don't worry. We're happy for you. We had a good time too, but there is something that does bother us. We never see you anymore. It's kind of awkward.</p>
<p>We know, we know. You've been busy. You got your projects and the office has been a mad house. We TOTALLY understand. We have stuff going on too. Like we've been wicked busy. It's just that when we don't hear from you we kind of feel used. Sorry. "Used" is too strong of a word. Well it's like this. Even though the role of Blogger has evolved over the years, the stigma of having a high bounce rate still exists. Once word gets out on the street you have a high bounce rate, people have no problem stopping in, getting their answer, and then leaving without so much as a comment.</p>
<p>Oh god. We're sorry. We can see your eyes glossing over. Look, we don't expect you to leave a message on our Facebook or Twitter page every day. We don't expect you to immediately introduce us to your CIO or CTO. We know those are big steps. Don't get us wrong. We have lives of our own and don't want to get tied down either.</p>
<p>All we want is for you to follow us on <a href="http://twitter.com/themorphicgroup" target="_blank">Twitter</a> or become a fan of our Facebook <a href="http://www.facebook.com/pages/The-Morphic-Group/7660059611?ref=ts" target="_blank">page</a> and occasionally let us know if you like what we are doing. That's all. Who knows. You might find out we're more than a nice pair of technical tutorials and that we are also interesting and <a href="http://www.themorphicgroup.com/blog/2009/07/15/the-morphic-groups-new-captcha/">funny</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/07/16/dear-blog-reader/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Morphic Group&#8217;s New CAPTCHA</title>
		<link>http://www.themorphicgroup.com/blog/2009/07/15/the-morphic-groups-new-captcha/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/07/15/the-morphic-groups-new-captcha/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 16:59:32 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Views]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=199</guid>
		<description><![CDATA[I try to do my part to make gmail more fun. (On the gmail sign in page it does say they're trying to make email more fun.) The trouble with gmail is that most people's gmail addresses are anything but fun. Most gmail addresses are something like fred.williams@gmail.com, whereas hotmail accounts are usually more like [...]]]></description>
			<content:encoded><![CDATA[<p>I try to do my part to make gmail more fun. (On the gmail sign in page it does say they're trying to make email more fun.) The trouble with gmail is that most people's gmail addresses are anything but fun. Most gmail addresses are something like fred.williams@gmail.com, whereas hotmail accounts are usually more like sassysinger23@hotmail.com. In order to make gmail more fun and improve its image I sign up for hotmail-style addresses like purplepanda88@gmail.com and snugglyteddy47@gmail.com.</p>
<p>The other day I was signing up for a new gmail account, just filling out the form as usual. I clicked the submit button, and I got an error. Apparently I hadn't typed the correct value for the CAPTCHA field. (In case you're wondering what a CAPTCHA is, it's that image and text input usually with instructions like "type the letters that you see.")  I was puzzled at what had happened. Certainly it couldn't have been BECAUSE THE CAPTCHA WAS IMPOSSIBLE TO READ. I figured that I must have just mistyped.  I tried the new CAPTCHA that gmail provided, certain that I'd gotten it right this time. Again, an error.  It wasn't until about the twentieth CAPTCHA that I was able to eventually create 2hot4u_55@gmail.com.</p>
<p>This got me thinking, though. I see CAPTCHAs everywhere except on The Morphic Group's blog. And if CAPTCHAs are good enough for Google then they are good enough for The Morphic Group. That's why I've decided to add a CAPTCHA to our blog for comments.</p>
<p>I don't actually think the addition of a CAPTCHA will have an effect on comments spam. We've already got the 500 WordPress plugins installed for that, and they work nicely to keep the comments spam to only a few hundred a day. The point is just that people expect a certain user experience these days. If you don't have a CAPTCHA then people will feel that something is missing from their experience on your blog. I wouldn't want anyone to have too easy of a time posting a comment on the blog and feel that they'd had a bad user experience on our site. That's the real reason for adding the CAPTCHA.</p>
<p>We decided to outsource the development of the CAPTCHA system for our blog to a company that says that between their teams in India, China, and somewhere in Brazil they can have developers working 24 hours a day for only 55 cents an hour.  The only trouble is that they only communicate by email, and we can't really understand their emails. We can only understand the part that says "next week, very soon." In the meantime, we did get a comp image from them. We think it looks like it will work great. It seems exactly like the CAPTCHA systems we see on every site, including gmail. This is what it looks like.</p>
<div id="attachment_201" class="wp-caption alignnone" style="width: 169px"><img class="size-full wp-image-201" title="CAPTCHA" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/07/Cap.jpg" alt="CAPTCHA" width="159" height="55" /><p class="wp-caption-text">CAPTCHA</p></div>
<p>Go ahead. Type the letters you see.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/07/15/the-morphic-groups-new-captcha/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Use Asynchronous Test Methods with FlexUnit 4</title>
		<link>http://www.themorphicgroup.com/blog/2009/07/15/how-to-use-asynchronous-test-methods-with-flexunit-4/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/07/15/how-to-use-asynchronous-test-methods-with-flexunit-4/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 15:38:54 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=211</guid>
		<description><![CDATA[An essential part of Agile Development is to embrace the use of unit testing throughout the development of your project. Unit tests give the programmer to ability to run automated tests on their code at anytime to ensure that any refactoring or added code has not broken what was previously written. This luxury is a [...]]]></description>
			<content:encoded><![CDATA[<p>An essential part of  Agile Development  is to embrace the use of unit testing throughout the development of your project. Unit tests give the programmer to ability to run automated tests on their code at anytime to ensure that any refactoring or added code has not broken what was previously written. This luxury is a welcome proposition for many programmers.</p>
<p>However, this has proven to be problematic for Flex developers for a variety of reasons. The first reason is that because Flex/Flash is a presentation tier technology a great deal of testing requires user interaction. Another problem is that  Flex/Flash is a client-side technology and therefore data saving and retrieval is an asynchronous process. In this post, I'm going to cover on how to handle the latter with FlexUnit 4.</p>
<p>With the first implementation of FlexUnit, a programmer could handle an asynchronous test by using a combination of timers and the built in addSync method of FlexUnit. Here's an example pulled from this blog <a href="http://life.neophi.com/danielr/2007/03/asynchronous_testing_with_flex.html" target="_blank">post</a>:</p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _timer<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Timer</span></a>;
&nbsp;
override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> tearDown<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>
    _timer.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    _timer = <span style="color: #0033ff; font-weight: bold;">null</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> testTimer<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>
    _timer = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Timer</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">3000</span>, <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>;
    _timer.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TimerEvent</span></a>.<span style="color: #004993;">TIMER</span>, incrementCount<span style="color: #000000;">&#41;</span>;
    _timer.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TimerEvent</span></a>.<span style="color: #004993;">TIMER_COMPLETE</span>, addAsync<span style="color: #000000;">&#40;</span>verifyCount, <span style="color: #000000; font-weight:bold;">3500</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
    _timer.<span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre>
<p>As you may have noticed, this code is a bit confusing. Basically what is happening is that FlexUnit is being told to wait 3.5 seconds before checking to see if &quot;verifyCount&quot; has been invoked. While this code works, it's a bit clunky and not very intuitive. You have to create a timer, add event listeners for the timer, and then actually tell the timer to run. This may seem to be a  trivial complaint, but when you have to write a series of tests with dependencies on previously written async tests this can get pretty tedious pretty quickly.</p>
<p>With Flex Unit 4 asynch test functions have been streamlined to look something like this:</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#40;</span>async,timeout=<span style="color: #990000;">&quot;3000&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> UserRegistration<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>
&nbsp;
	Async.handleEvent<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>, _service, ServiceEvent.USER_REGISTERED, onUserRegistered<span style="color: #000000;">&#41;</span>;
	_service.registerUser<span style="color: #000000;">&#40;</span>_testEmailStr<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onUserRegistered<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span>ServiceEvent, param2<span style="color: #000000; font-weight: bold;">:*</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>
	_testUser = UserVO.fromObject<span style="color: #000000;">&#40;</span>event.<span style="color: #004993;">data</span><span style="color: #000000;">&#41;</span>;
	Assert.assertNotNull<span style="color: #000000;">&#40;</span>_testUser<span style="color: #000000;">&#41;</span>;
	Assert.assertTrue<span style="color: #000000;">&#40;</span>_testUser.email == _testEmailStr<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #000000;">&#125;</span></pre>
<p>In this example, we have a test function called &quot;UserRegistration.&quot; This function will test if my async call to the server to register a user has worked. Notice the the &quot;Async.handleEvent&quot; line of code. In this line we are telling Flex Unit 4 to listen for an event that &quot;_service&quot; will be broadcasting. This line of code also tells FlexUnit to invoke the handler function &quot;onUserRegistered&quot; if &quot;_service&quot; does broadcast this event. The meta tag line above the declaration for UserRegistration also specifies that this test function should issue a failure notification if the function takes longer than 3 seconds to complete.</p>
<p>As for the actual &quot;onUserRegistered&quot; handler, we run an assertion to make sure the new VO got parsed correctly. Once that is done, we also make sure the properties of the new VO were set correctly.</p>
<p>For more information about FlexUnit 4 be sure to checkout Digital Primate's FlexUnit in 360 seconds <a href="http://blogs.digitalprimates.net/codeSlinger/index.cfm/2009/5/3/FlexUnit-4-in-360-seconds">post</a> as well as O'Reilly's <a href="http://www.insideria.com/2009/05/flashbuilder4-will-support-fle.html">post</a>. If you would like FlexUnit 4 to be directly integrated with your copy of Flash Builder today check this <a href="http://blogs.digitalprimates.net/codeSlinger/index.cfm/FlexUnit">link</a> out as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/07/15/how-to-use-asynchronous-test-methods-with-flexunit-4/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Ant Compiling in Flex Builder &#8220;Error: Java heap space&#8221;</title>
		<link>http://www.themorphicgroup.com/blog/2009/07/10/compiling-using-ant-in-flex-builder-error-java-heap-space/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/07/10/compiling-using-ant-in-flex-builder-error-java-heap-space/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 22:27:08 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Ant]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=186</guid>
		<description><![CDATA[This week, I wanted to use Ant to compile a large project with a couple external libraries. Right after a few seconds of running my build.xml using Ant, I received this ugly message: compile flex project: [mxmlc] Loading configuration file C:\Program Files\Adobe\Flex Builder 3\sdks\3.3.0\frameworks\flex-config.xml [mxmlc] Error: Java heap space [mxmlc] java.lang.OutOfMemoryError: Java heap space ...... [...]]]></description>
			<content:encoded><![CDATA[<p>This week, I wanted to use Ant to compile a large project with a couple external libraries. Right after a few seconds of running my build.xml using Ant, I received this ugly message:</p>
<p><em>compile flex project:<br />
[mxmlc] Loading configuration file C:\Program Files\Adobe\Flex Builder 3\sdks\3.3.0\frameworks\flex-config.xml<br />
[mxmlc] <strong>Error: Java heap space</strong><br />
[mxmlc] java.lang.OutOfMemoryError: Java heap space</em><br />
......<em><br />
</em></p>
<p><em>BUILD FAILED</em></p>
<p>Boooooo!</p>
<p>After consulting a couple of documents and search google, I found a solution that I decided to share. A lot of documentation states that you should change or add the environment variable ANT_OPTS to the particular size (Windows). This didn't work for me. The solution involves changing a particular property in Flex Builder. I really should thank Eric Fickes for <a href="http://ericfickes.com/2008/10/osx-flexbuilder-java-heap-space-error/" target="_blank">his blog</a> on this issue on Mac.  My solution is for Windows.</p>
<p>Go to Window --&gt; Preferences</p>
<p>From the menu select Java --&gt;Installed JREs</p>
<p><img class="alignnone size-full wp-image-187" title="screenshot1" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/07/screenshot1.jpg" alt="screenshot1" width="600" height="412" /></p>
<p>Select the VM and click the edit button. In "Default VM Arguments" enter "-Xmx512m" without quotes. This value may vary as well as performance.</p>
<p><img class="alignnone size-full wp-image-188" title="screenshot2" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/07/screenshot2.jpg" alt="screenshot2" width="400" height="456" /></p>
<p>Hopefully this makes your life a little easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/07/10/compiling-using-ant-in-flex-builder-error-java-heap-space/feed/</wfw:commentRss>
		<slash:comments>9</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>Google App Engine Text Datastore Object not Saving with AMF</title>
		<link>http://www.themorphicgroup.com/blog/2009/07/02/google-app-engine-text-datastore-object-not-saving-with-amf/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/07/02/google-app-engine-text-datastore-object-not-saving-with-amf/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 17:01:43 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[AMF]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[granite ds]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=162</guid>
		<description><![CDATA[I've been working with creating a Flex app with Google App Engine and AMF based on Sekhar Ravinutala's blog post about using GraniteDS and the new Java framework for GAE. Everything was going smoothly until I needed to use a datastore Text object instead of a standard string property because a string can only contain 500 [...]]]></description>
			<content:encoded><![CDATA[<p>I've been working with creating a Flex app with Google App Engine and AMF based on Sekhar Ravinutala's blog <a href="http://blog.allurefx.com/2009/05/cloud-to-ria-accessing-google-app_26.html">post</a> about using GraniteDS and the new Java framework for GAE. Everything was going smoothly until I needed to use a datastore Text object instead of a standard string property because a string can only contain 500 characters. Anytime I would save my item class to the datastore the text property would always come back null on subsequent requests to retrieve the item from the database. Turns out all you have to do is add the following line above your text property's declaration like so:</p>
<p>@Persistent(defaultFetchGroup="true")<br />
Text description;</p>
<p>I was able to find this solution in a Google groups thread <a href="http://groups.google.com/group/google-appengine-java/msg/ac94665af70cf61a">here</a>. Apparently, for optimization reasons not all fields are retrieved when an object is requested from the database. With the line of code above, we force the description property to be retrieved.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/07/02/google-app-engine-text-datastore-object-not-saving-with-amf/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating a Spark Resizable Title Window with Adobe Catalyst and Flash Builder</title>
		<link>http://www.themorphicgroup.com/blog/2009/06/26/creating-a-spark-resizable-title-window-with-adobe-catalyst-and-flash-builder/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/06/26/creating-a-spark-resizable-title-window-with-adobe-catalyst-and-flash-builder/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 16:41:38 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Adobe Catalyst]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Spark]]></category>
		<category><![CDATA[SparkSkin]]></category>
		<category><![CDATA[TitleWindow]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=145</guid>
		<description><![CDATA[You may have noticed that with the new Spark components there isn't a new TitleWindow, much like the lack of icon property in a Spark button I wrote about in a previous post. In this tutorial, I'm going to demonstrate how to create a resizable TitleWindow using the new Spark SkinnableContainer component. You can view [...]]]></description>
			<content:encoded><![CDATA[<p>You may have noticed that with the new <a href="http://danorlando.com/?p=374">Spark</a> components there isn't a new <a href="http://livedocs.adobe.com/flex/2/langref/mx/containers/TitleWindow.html">TitleWindow</a>, much like the lack of icon property in a Spark button I wrote about in a previous <a href="http://www.themorphicgroup.com/blog/2009/06/18/how-to-create-a-spark-icon-button-and-skin/">post</a>. In this tutorial, I'm going to demonstrate how to create a resizable TitleWindow using the new Spark <a href="http://livedocs.adobe.com/flex/gumbo/langref/spark/components/SkinnableContainer.html">SkinnableContainer</a> component. You can view the results of this demo <a href="http://www2.themorphicgroup.com/blog/sparkTitleWindow/" target="_blank">here</a> or if you just want to grab the code and be on your way, you can download it <a href="http://www2.themorphicgroup.com/blog/sparkTitleWindow/SparkTitleWindow.zip">here</a>.</p>
<p><strong>Create the UI elements in Catalyst</strong>.</p>
<p>The following screenshot demonstrates how I built and organized the components in my <a href="http://labs.adobe.com/technologies/flashcatalyst/">Catalyst</a> project. For this component, I'm going to need a background, a header, a close button, and a handle to resize the button. I was able to name these components what I wanted by changing their names in the Library panel. Because Catalyst doesn't really let you know the type of components on the stage, it helps to rename these as you build each one.</p>
<p><img src="http://www2.themorphicgroup.com/blog/sparkTitleWindow/catalyst.jpg"/></p>
<p><strong>Import and tweak the Catalyst components in Flash Builder.</strong></p>
<p>After importing the Catalyst project into <a href="http://livedocs.adobe.com/flex/gumbo/html/WS65aa2914f20a58ebd123e2512119993c71-8000.html">Flash Builder</a> I made some changes to the following components:</p>
<p>TitleWindowBG.mxml</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>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><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;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span> radiusY=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> radiusX=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.75&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>SolidColor <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#000000&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>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></pre>
<p>With this component I set the height and width of the rectangle to 100%. Currently Catalyst only lets you specify height and widths as fixed numbers.</p>
<p>TitleWindowCloseButton.mxml</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Skin 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><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>states<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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;up&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;over&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;down&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;disabled&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>states<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>Metadata<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000;">&#91;</span>HostComponent<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;spark.components.Button&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">&lt;/</span>fx<span style="color: #000000; font-weight: bold;">:</span>Metadata<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;">height</span>=<span style="color: #990000;">&quot;21&quot;</span> radiusY=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;21&quot;</span> radiusX=<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>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;#7f0000&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;#ff0000&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>RichText
		id=<span style="color: #990000;">&quot;labelElement&quot;</span>
		<span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;7&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;6&quot;</span>
		<span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#ffffff&quot;</span>
		<span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;(Label)&quot;</span>
		<span style="color: #004993;">fontSize</span>=<span style="color: #990000;">&quot;12&quot;</span> fontFamily=<span style="color: #990000;">&quot;Arial&quot;</span> fontWeight=<span style="color: #990000;">&quot;bold&quot;</span>
		<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;8&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;12&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>Skin<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;</pre>
<p>I cleaned out some transistion stuff that wasn't necassary.</p>
<p>TitleWindowHeader.mxml</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Skin 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><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>states<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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;up&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;over&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;down&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;disabled&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>states<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>Metadata<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000;">&#91;</span>HostComponent<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;spark.components.Button&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">&lt;/</span>fx<span style="color: #000000; font-weight: bold;">:</span>Metadata<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;">height</span>=<span style="color: #990000;">&quot;28&quot;</span> radiusY=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;0&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;0&quot;</span> radiusX=<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>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;#ff0000&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>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
		id=<span style="color: #990000;">&quot;labelElement&quot;</span>
		<span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;8&quot;</span>
		<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;14&quot;</span>
		<span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#ffffff&quot;</span>
		<span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;(Label)&quot;</span>
		<span style="color: #004993;">fontSize</span>=<span style="color: #990000;">&quot;14&quot;</span> fontFamily=<span style="color: #990000;">&quot;Arial&quot;</span> fontWeight=<span style="color: #990000;">&quot;bold&quot;</span>
		<span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;20&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>Skin<span style="color: #000000; font-weight: bold;">&gt;</span></pre>
<p>I set the left and right properties of the Rect and RichText so it would change size with our eventual component.</p>
<p>TitleWindowResizeHandle.mxml</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Skin
	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>
	<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span>
	<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&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>states<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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;up&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;over&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;down&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>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;disabled&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>states<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>Metadata<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000;">&#91;</span>HostComponent<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;spark.components.Button&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">&lt;/</span>fx<span style="color: #000000; font-weight: bold;">:</span>Metadata<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: #004993;">y</span>=<span style="color: #990000;">&quot;22&quot;</span> <span style="color: #004993;">rotation</span>=<span style="color: #990000;">&quot;-45&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&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>Rect <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;5&quot;</span> radiusY=<span style="color: #990000;">&quot;3&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;31&quot;</span> radiusX=<span style="color: #990000;">&quot;3&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.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>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>SolidColor <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;0xFFFFFF&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>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>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;8&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;5&quot;</span> radiusX=<span style="color: #990000;">&quot;3&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;18&quot;</span> <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;7&quot;</span> radiusY=<span style="color: #990000;">&quot;3&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.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>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>SolidColor <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;0xFFFFFF&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>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>Rect <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;16&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;5&quot;</span> radiusX=<span style="color: #990000;">&quot;3&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;14&quot;</span> radiusY=<span style="color: #990000;">&quot;3&quot;</span> <span style="color: #004993;">alpha</span>=<span style="color: #990000;">&quot;0.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>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>SolidColor <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;0xFFFFFF&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>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>
	<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Rect <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>
		<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>SolidColor <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;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>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>Skin<span style="color: #000000; font-weight: bold;">&gt;</span></pre>
<p>With this component I set the height and width of the artwork Group to 100% and added a transparent Rect to help catch mouse events better.</p>
<p><strong>Create a SparkTitleWindow class that extends SkinnableContainer.</strong></p>
<p>For our custom component we create two public bindable properties &quot;title&quot; and &quot;isResizable&quot; so a developer can easier implement the component. We also declare a &quot;close&quot; event that uses the standard <a href="http://livedocs.adobe.com/flex/201/langref/mx/events/CloseEvent.html">CloseEvent</a> object. For the dragging and resizing functionality, we create start and stop methods that start/stop a <a href="http://livedocs.adobe.com/flex/2/langref/flash/utils/Timer.html">Timer</a> that keeps track of the mouse position.</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #9900cc; font-weight: bold;">package</span> com.tmg.components
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TimerEvent</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span>.<a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span>.<a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Timer</span></a>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.core.UIComponent;
	<span style="color: #0033ff; font-weight: bold;">import</span> mx.events.CloseEvent;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> spark.components.SkinnableContainer;
	<span style="color: #000000;">&#91;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Event</span></a><span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;close&quot;</span>, <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;mx.events.CloseEvent&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> SparkTitleWindow extends SkinnableContainer
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> static const DRAG_INTERVAL<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a> = <span style="color: #000000; font-weight:bold;">1</span>;
		<span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span>
		<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;&quot;</span>;
		<span style="color: #000000;">&#91;</span>Bindable<span style="color: #000000;">&#93;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> isResizable<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=boolean%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:boolean.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Boolean</span></a> = <span style="color: #0033ff; font-weight: bold;">true</span>;
		<span style="color: #009900;">//drag props</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _dragTimer<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Timer</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Timer</span></a><span style="color: #000000;">&#40;</span>DRAG_INTERVAL<span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _dragInitPoint<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _dragHandle<span style="color: #000000; font-weight: bold;">:</span>UIComponent;
		<span style="color: #009900;">//resize props</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _resizeTimer<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Timer</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=timer%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timer.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Timer</span></a><span style="color: #000000;">&#40;</span>DRAG_INTERVAL<span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _resizeInitPoint<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _resizeHandle<span style="color: #000000; font-weight: bold;">:</span>UIComponent;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> SparkTitleWindow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> closeWindow<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: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> CloseEvent<span style="color: #000000;">&#40;</span>CloseEvent.<span style="color: #004993;">CLOSE</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #009900;">//drag methods/handlers</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> startWindowDrag<span style="color: #000000;">&#40;</span>dragHandle<span style="color: #000000; font-weight: bold;">:</span>UIComponent<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: #0033ff; font-weight: bold;">this</span>._dragHandle = dragHandle;
			_dragInitPoint = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a><span style="color: #000000;">&#40;</span>_dragHandle.<span style="color: #004993;">mouseX</span>, _dragHandle.<span style="color: #004993;">mouseY</span><span style="color: #000000;">&#41;</span>;
			_dragTimer.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TimerEvent</span></a>.<span style="color: #004993;">TIMER</span>, onDragTimerTick, <span style="color: #0033ff; font-weight: bold;">false</span>, <span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
			_dragTimer.<span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> stopWindowDrag<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>
			_dragTimer.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			_dragTimer.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TimerEvent</span></a>.<span style="color: #004993;">TIMER</span>, onDragTimerTick<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onDragTimerTick<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TimerEvent</span></a><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> currentMousePoint<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a><span style="color: #000000;">&#40;</span>_dragHandle.<span style="color: #004993;">mouseX</span>, _dragHandle.<span style="color: #004993;">mouseY</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #6699cc; font-weight: bold;">var</span> gPoint<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a> = _dragHandle.<span style="color: #004993;">localToGlobal</span><span style="color: #000000;">&#40;</span>currentMousePoint<span style="color: #000000;">&#41;</span>;
			<span style="color: #6699cc; font-weight: bold;">var</span> lPoint<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a> = <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.<span style="color: #004993;">globalToLocal</span><span style="color: #000000;">&#40;</span>gPoint<span style="color: #000000;">&#41;</span>;
			<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">x</span> = lPoint.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> _dragInitPoint.<span style="color: #004993;">x</span>;
			<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">y</span> = lPoint.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span> _dragInitPoint.<span style="color: #004993;">y</span>;
&nbsp;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #009900;">//resize methods/handlers</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> startWindowResize<span style="color: #000000;">&#40;</span>resizeHandle<span style="color: #000000; font-weight: bold;">:</span>UIComponent<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: #0033ff; font-weight: bold;">this</span>._resizeHandle = resizeHandle;
			_resizeInitPoint = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a><span style="color: #000000;">&#40;</span>_resizeHandle.<span style="color: #004993;">mouseX</span>, _resizeHandle.<span style="color: #004993;">mouseY</span><span style="color: #000000;">&#41;</span>;
			_resizeTimer.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TimerEvent</span></a>.<span style="color: #004993;">TIMER</span>, onResizeTimerTick, <span style="color: #0033ff; font-weight: bold;">false</span>, <span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
			_resizeTimer.<span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> stopWindowResize<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>
			_resizeTimer.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			_resizeTimer.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TimerEvent</span></a>.<span style="color: #004993;">TIMER</span>, onResizeTimerTick<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onResizeTimerTick<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=timerevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:timerevent.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TimerEvent</span></a><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> currentMousePoint<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a><span style="color: #000000;">&#40;</span>_resizeHandle.<span style="color: #004993;">mouseX</span>, _resizeHandle.<span style="color: #004993;">mouseY</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #6699cc; font-weight: bold;">var</span> gPoint<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a> = _resizeHandle.<span style="color: #004993;">localToGlobal</span><span style="color: #000000;">&#40;</span>currentMousePoint<span style="color: #000000;">&#41;</span>;
			<span style="color: #6699cc; font-weight: bold;">var</span> lPoint<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=point%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:point.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Point</span></a> = <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">parent</span>.<span style="color: #004993;">globalToLocal</span><span style="color: #000000;">&#40;</span>gPoint<span style="color: #000000;">&#41;</span>;
			<span style="color: #6699cc; font-weight: bold;">var</span> newWidth<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a> = <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">+</span> lPoint.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">x</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>_resizeHandle.<span style="color: #004993;">width</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #6699cc; font-weight: bold;">var</span> newHeight<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Number</span></a> = <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">+</span> lPoint.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span>_resizeHandle.<span style="color: #004993;">height</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>newWidth <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #0033ff; font-weight: bold;">this</span>.minWidth<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">width</span> = newWidth;
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>newHeight <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #0033ff; font-weight: bold;">this</span>.minHeight<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">height</span> = newHeight;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
<p><strong>Create SparkTitleWindow SparkSkin.</strong></p>
<p>The last step before implementation is create our <a href="http://livedocs.adobe.com/flex/gumbo/langref/spark/skins/SparkSkin.html">SparkSkin</a> mxml component for our window. This where we incorporate the components we created in Catalyst. Note the Group component &quot;contentGroup.&quot; Because our host component is a SkinnableContainer it is required to have this Group object. This is where the contents of our new container will go.</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Skin
	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>
	<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> components.TitleWindowResizeHandle;
		<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>
	<span style="color: #000000; font-weight: bold;">&lt;</span>fx<span style="color: #000000; font-weight: bold;">:</span>Metadata<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000;">&#91;</span>HostComponent<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;com.tmg.components.SparkTitleWindow&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>fx<span style="color: #000000; font-weight: bold;">:</span>Metadata<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>states<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>State <span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;normal&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>states<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>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>TitleWindowBG
		id=<span style="color: #990000;">&quot;windowBG&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>
	<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Button
		id=<span style="color: #990000;">&quot;windowHeader&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: #004993;">right</span>=<span style="color: #990000;">&quot;5&quot;</span>
		skinClass=<span style="color: #990000;">&quot;components.TitleWindowHeader&quot;</span>
		label=<span style="color: #990000;">&quot;{hostComponent.title}&quot;</span>
		<span style="color: #004993;">mouseDown</span>=<span style="color: #990000;">&quot;{ hostComponent.startWindowDrag(windowHeader) }&quot;</span>
		<span style="color: #004993;">mouseUp</span>=<span style="color: #990000;">&quot;{ hostComponent.stopWindowDrag() }&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>Button
		id=<span style="color: #990000;">&quot;closeButton&quot;</span>
		label=<span style="color: #990000;">&quot;X&quot;</span>
		<span style="color: #004993;">buttonMode</span>=<span style="color: #990000;">&quot;true&quot;</span>
		skinClass=<span style="color: #990000;">&quot;components.TitleWindowCloseButton&quot;</span>
		<span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;7&quot;</span> <span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;8&quot;</span>
		<span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;{ hostComponent.closeWindow()}&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
		id=<span style="color: #990000;">&quot;contentGroup&quot;</span>
		clipAndEnableScrolling=<span style="color: #990000;">&quot;true&quot;</span>
		<span style="color: #004993;">top</span>=<span style="color: #990000;">&quot;{windowHeader.y + windowHeader.height + 10}&quot;</span>
		<span style="color: #004993;">left</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;5&quot;</span> <span style="color: #004993;">bottom</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: #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>
	<span style="color: #000000; font-weight: bold;">&lt;</span>s<span style="color: #000000; font-weight: bold;">:</span>Button
		id=<span style="color: #990000;">&quot;resizeButton&quot;</span>
		<span style="color: #004993;">right</span>=<span style="color: #990000;">&quot;2&quot;</span> <span style="color: #004993;">bottom</span>=<span style="color: #990000;">&quot;2&quot;</span>
		<span style="color: #004993;">mouseDown</span>=<span style="color: #990000;">&quot;{ hostComponent.startWindowResize(resizeButton)}&quot;</span>
		<span style="color: #004993;">mouseUp</span>=<span style="color: #990000;">&quot;{ hostComponent.stopWindowResize()}&quot;</span>
		<span style="color: #004993;">visible</span>=<span style="color: #990000;">&quot;{ hostComponent.isResizable }&quot;</span>
		skinClass=<span style="color: #990000;">&quot;components.TitleWindowResizeHandle&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>Skin<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;</pre>
<p>Also note how we are able to access our newley written public properties and methods via the &quot;<a href="http://livedocs.adobe.com/flex/gumbo/html/WSA95C9644-B650-4783-B5C0-D2C7F95A23E3.html">hostComponent</a>&quot; property.
</p>
<p><strong>Implement new component.</strong></p>
<p>With our new container written and skin created, we can now implement this new window component.</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>SparkTitleWindow
		id=<span style="color: #990000;">&quot;myWindow&quot;</span>
		skinClass=<span style="color: #990000;">&quot;com.tmg.skins.SparkTitleWindowSkin&quot;</span>
		title=<span style="color: #990000;">&quot;My Title Window&quot;</span>
		<span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;200&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;50&quot;</span>
		<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;300&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;300&quot;</span>
		<span style="color: #004993;">close</span>=<span style="color: #990000;">&quot;{myWindow.visible=false}&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>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>VerticalLayout<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>layout<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Label <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;These are the contents of my window:&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>TextInput
			<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span>
			<span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#000000&quot;</span>
			<span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;A text input...&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>TextArea
			<span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span>
			<span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;A textarea...&quot;</span>
			<span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#000000&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>Button label=<span style="color: #990000;">&quot;A Button&quot;</span> <span style="color: #004993;">color</span>=<span style="color: #990000;">&quot;#000000&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>SparkTitleWindow<span style="color: #000000; font-weight: bold;">&gt;</span></pre>
<p><strong>Summary</strong></p>
<p>There you have it, a brand new container that can be dragged and/or resized. If you don't want to use Catalyst to edit the look and feel of you new component, you could declare style properties in the SparkTitleWindow class and in your skin component bind to these properties. An example of this can be found in my previous Spark <a href="http://www.themorphicgroup.com/blog/2009/06/18/how-to-create-a-spark-icon-button-and-skin/">post</a> where we create an <a href="http://www.themorphicgroup.com/blog/2009/06/18/how-to-create-a-spark-icon-button-and-skin/">IconButton</a>.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/06/26/creating-a-spark-resizable-title-window-with-adobe-catalyst-and-flash-builder/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A Chat About PHP with Adobe Flash Builder 4 and Flash Catalyst</title>
		<link>http://www.themorphicgroup.com/blog/2009/06/25/a-chat-about-php-with-flash-builder-4-and-adobe-catalyst/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/06/25/a-chat-about-php-with-flash-builder-4-and-adobe-catalyst/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 19:45:42 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Adobe Catalyst]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[Adobe Flash Builder 4]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=90</guid>
		<description><![CDATA[With all the hoopla that is going on with the Flash Platform... probably the biggest news comes from Flash Builder 4 (Flex) with Data Services. The new wizards that can introspect your data service and help you create code to build effortlessly (well at least it is a good start). You may use whatever flavor [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-bottom: 0in;">With all the hoopla that is going on with the Flash Platform... probably the biggest news comes from Flash Builder 4 (Flex) with Data Services. The new wizards that can introspect your data service and help you create code to build effortlessly (well at least it is a good start). You may use whatever flavor server-side technology you want - from Blaze DS, Cold Fusion, and PHP. This last technology is the focus of my little article. I also talk little bit about the work flow with Flash Catalyst and Flash Builder.</p>
<p style="margin-bottom: 0in;"><strong>ZEND Framework</strong></p>
<p style="margin-bottom: 0in;">First, I will briefly go over how to create a php data service using the wizard provided in Flash Builder. You first need to set up your project as you would for any service (Properties &gt; Flex Server). Once you have configure your php service Class and Package name, you are prompted to use Zend framework. The big hook here is the AMF support which also helps to introspect objects. I will say that the Zend framework has a lot of powerful features and is well know in the php community. The framework's size is 17 MB and needs to be uploaded to your web site whether you like it or not. You can't skip this step. This cause a couple of concerns. What if you Zend installed locally? What if in the future a new version of Zend is released won't this upload be a bit dated at some point?</p>
<p style="margin-bottom: 0in;"><img class="alignnone size-full wp-image-94" title="flexServer" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/06/flexServer.jpg" alt="flexServer" width="470" height="435" /></p>
<p style="margin-bottom: 0in;"><img class="alignnone size-full wp-image-93" title="MyService_ZEND" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/06/MyService_ZEND.jpg" alt="MyService_ZEND" width="480" height="482" /></p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		A:link { so-language: zxx } --></p>
<p style="margin-bottom: 0in;">From this point on your can get auto generated value objects, configure return types, bind to components just to name a few features. Here is a few great tutorials that illustrate these features and more with Zend:</p>
<ul>
<li><a href="http://devzone.zend.com/article/4705">Data-centric Adobe Flash Builder development with the Zend Framework </a></li>
<li><a href="http://www.adobe.com/devnet/flashcatalyst/articles/building_datacentric_app_flashcast_flashbuilder.html">Building a data-centric application using Flash Catalyst beta and Flash Builder 4 beta</a></li>
<li><a href="http://www.gotoandlearn.com/play?id=110">Lee Brimelow's Flash Builder 4 beta and Flash Catalyst beta video tutorial</a></li>
</ul>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="margin-bottom: 0in;"><strong>AMFPHP</strong></p>
<p style="margin-bottom: 0in;">For the rest of this article, I will take a slightly different path as far as creating a PHP service. I will discuss how to implement a Flex project using PHP with AMFPHP (About a little over 700 KB).</p>
<p style="margin-bottom: 0in;">To illustrate this process, I will run through a simple example application – “CelebrationEvent”, a check list utility. The premise is to distribute a list of items needed  for a party or celebration for a group of friends. In this application, users will log in and sign up for items to be in charge of bringing to the event.</p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="margin-bottom: 0in;">For this application, I went through the whole cycle from design to development with Illustrator CS3, Adobe Flash Catalyst, and Adobe Flash Builder 4.  I do have some comments on this work flow (trial and error) but my focus here is the actual service creation itself.</p>
<p style="margin-bottom: 0in;">Here is a screen shot of the work at beginning stage:</p>
<p style="margin-bottom: 0in;"><img class="alignnone size-full wp-image-95" title="CelebrationEventListLayout" src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/06/CelebrationEventListLayout.jpg" alt="CelebrationEventListLayout" width="480" height="362" /></p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="margin-bottom: 0in;"><em><strong>Setup Process</strong></em></p>
<p style="margin-bottom: 0in;">Since there is no data service wizard, there is a manual setup process involved. In other words, create a remote object.</p>
<p style="margin-bottom: 0in;">Note: Download <a href="http://www.amfphp.org/" target="_blank">AMFPHP</a> if you haven't already done so already. Get familiar with folder structure and Setup. For “CelebrationEvent”, I'm 		using MySQL database with “phpMyAdmin”</p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="margin-bottom: 0in;"><strong>Create Database and Tables Structure </strong></p>
<p style="margin-bottom: 0in;"><span style="font-weight: normal;">For this application I c</span>reated the EventCelebration database with these tables:</p>
<ul>
<li>
<p style="margin-bottom: 0in;">EventList – check list items for 	the event</p>
</li>
<li>
<p style="margin-bottom: 0in;">Users – User list</p>
</li>
<li>
<p style="margin-bottom: 0in;">EventListToUser – relationship 	of user to check list.</p>
</li>
</ul>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;"><strong>Create the backend service – PHP/AMFPHP</strong></p>
<ul>
<li>
<p style="margin-bottom: 0in;">Update globals.php under AMFPHP folder root</p>
<ul>
<li>
<p style="margin-bottom: 0in;">Change "DB_HOST", "DB_USER", "DB_PASS" and "DB_NAME" to the corresponding database setting for host address, database privilage user , password and database name ("EventCelebration")</p>
</li>
</ul>
</li>
<li>
<p style="margin-bottom: 0in;">The Service Class: 	CelebrationEventService.php</p>
<ul>
<li>
<p style="margin-bottom: 0in;">Class has four methods – 		createUser(), loginUser(), getList(), and signUpForItem()</p>
</li>
<li>
<p style="margin-bottom: 0in;">You would add this class file under the “services” folder of your AMF Folder</p>
</li>
</ul>
</li>
<li>
<p style="margin-bottom: 0in;">Value Objects: User.php and EventItem.php</p>
<ul>
<li>
<p style="margin-bottom: 0in;">Note: Make sure you reference the data type mapped to the corresponding actionscript value objects “explicitType”.</p>
</li>
<li>
<p style="margin-bottom: 0in;">You would add these class files under “services/vo/[folder package 	structure]</p>
</li>
<li>
<p style="margin-bottom: 0in;">Example folder: “services/vo/com/themorphicgroup/celebrateEvent”</p>
</li>
<li>
<p style="margin-bottom: 0in;">See Sample Code Below</p>
</li>
</ul>
</li>
</ul>
<div><strong>Code Sample - User VO</strong></div>
<div>
<div>&lt;?php<br />
class User {<br />
var $id;<br />
var $fullName;<br />
var $email;<br />
var $password;</p>
<p>// explicit actionscript package<br />
var $_explicitType = "com.themorphicgroup.celebrateEvent.User";</p>
<p>/**<br />
* Constructor with default values<br />
*/<br />
function User($id = -1, $fullName = "", $email = "", $password = ""){<br />
$this-&gt;id = $id;<br />
$this-&gt;fullName = $fullName;<br />
$this-&gt;email = $email;<br />
$this-&gt;password = $password;<br />
}</p>
<p>}<br />
?&gt;</p></div>
</div>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;"><strong>Create objects and calls in your project - Flex</strong></p>
<ul>
<li>
<p style="margin-bottom: 0in;">RemoteObject with handlers</p>
<ul>
<li>
<p style="margin-bottom: 0in;">With the way that the project was 		imported into Flash Builder, I decided to create actionscript to 		create the remoteObject instead of MXML reference.</p>
</li>
<li>
<p style="margin-bottom: 0in;">See Sample Code Below</p>
</li>
</ul>
</li>
<li>
<p style="margin-bottom: 0in;">Value Objects: User.as and 	EventItem</p>
<ul>
<li>
<p style="margin-bottom: 0in;">Note: Great feature in Flash 		Builder 4… you can now create your private variables and create 		you getters and setters via right click, Source, Generate 		Getter/Setter. Very cool.</p>
</li>
<li>
<p style="margin-bottom: 0in;">Make sure that you add metadata 		to map these objects to the corresponding PHP objects.</p>
</li>
<li>
<p style="margin-bottom: 0in;">See Sample Code Below</p>
</li>
</ul>
</li>
</ul>
<div><strong>Code Samples - RemoteObject with handlers</strong></div>
<div>Note: Service call are not show here since they are used through out application</div>
<div>
<div>
<pre class="actionscript3" style="font-family:monospace;">...
&nbsp;
<span style="color: #0033ff; font-weight: bold;">import</span> mx.rpc.remoting.RemoteObject;
<span style="color: #0033ff; font-weight: bold;">import</span> mx.rpc.events.ResultEvent;
<span style="color: #0033ff; font-weight: bold;">import</span> mx.rpc.events.FaultEvent;
<span style="color: #0033ff; font-weight: bold;">import</span> mx.controls.Alert;
&nbsp;
...
&nbsp;
<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> RESULT<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;result&quot;</span>;
<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> FAULT<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;fault&quot;</span>; 
&nbsp;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _eventList<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Object</span></a>;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _service<span style="color: #000000; font-weight: bold;">:</span>RemoteObject;
&nbsp;
....
&nbsp;
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> createRemoteObject<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>
	_service = <span style="color: #0033ff; font-weight: bold;">new</span> RemoteObject<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
	_service.endpoint = <span style="color: #990000;">&quot;http://www.themorphicgroup.com/CelebrationEventList/service/gateway.php&quot;</span>;
	_service.<span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;CelebrationEventService&quot;</span>;
	_service.destination = <span style="color: #990000;">&quot;amfphp&quot;</span>; 
&nbsp;
	_service.showBusyCursor=<span style="color: #0033ff; font-weight: bold;">true</span>;
&nbsp;
	_service.getList.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>RESULT, getListResultHandler<span style="color: #000000;">&#41;</span>;
	_service.loginUser.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>RESULT, loginUserResultHandler<span style="color: #000000;">&#41;</span>;
	_service.createUser.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>RESULT, createUserResultHandler<span style="color: #000000;">&#41;</span>;
	_service.signUpForItem.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>RESULT, signUpForItemResultHandler<span style="color: #000000;">&#41;</span>;
&nbsp;
	_service.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>FAULT, faultHandler<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> getListResultHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span>ResultEvent<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>
	_eventList = event.result;
&nbsp;
	<span style="color: #6699cc; font-weight: bold;">var</span> dataProvider<span style="color: #000000; font-weight: bold;">:</span>ArrayCollection = <span style="color: #0033ff; font-weight: bold;">new</span> ArrayCollection<span style="color: #000000;">&#40;</span>event.result <span style="color: #0033ff; font-weight: bold;">as</span> <a href="http://www.google.com/search?q=array%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:array.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Array</span></a><span style="color: #000000;">&#41;</span>;
&nbsp;
	list1.dataProvider = dataProvider;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> loginUserResultHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span>ResultEvent<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>
	_currentUser = event.result <span style="color: #0033ff; font-weight: bold;">as</span> User;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>event.result <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		currentState=<span style="color: #990000;">'List'</span>;
		_service.getList<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span><span style="color: #000000;">&#123;</span>
		mx.controls.Alert.<span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Login Failed&quot;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
	inpName.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;&quot;</span>;
	inpEmail.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;&quot;</span>;
	inpPassword.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;&quot;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> createUserResultHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span>ResultEvent<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: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>event.result <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> user<span style="color: #000000; font-weight: bold;">:</span>User = User<span style="color: #000000;">&#40;</span>event.result <span style="color: #0033ff; font-weight: bold;">as</span> User<span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span><span style="color: #000000;">&#123;</span>
		mx.controls.Alert.<span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;User Creation Failed&quot;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>user <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		_service.loginUser<span style="color: #000000;">&#40;</span>user.email, user.password<span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span><span style="color: #000000;">&#123;</span>
		mx.controls.Alert.<span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;User Creation Failed&quot;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> signUpForItemResultHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span>ResultEvent<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: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>event.result<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		mx.controls.Alert.<span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Signed up for item&quot;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span><span style="color: #000000;">&#123;</span>
		mx.controls.Alert.<span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Item could not be Signed up&quot;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> faultHandler <span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span>FaultEvent<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>
	mx.controls.Alert.<span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Error&quot;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre>
</div>
</div>
<div><strong>Code Sample - User VO</strong></div>
<div>
<div>
<pre class="actionscript3" style="font-family:monospace;">...
<span style="color: #9900cc; font-weight: bold;">package</span> com.themorphicgroup.celebrateEvent
<span style="color: #000000;">&#123;</span>
	<span style="color: #000000;">&#91;</span>RemoteClass<span style="color: #000000;">&#40;</span>alias=<span style="color: #990000;">&quot;com.themorphicgroup.celebrateEvent.User&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> User
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _id<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: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _fullName<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: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _email<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: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _password<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>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> User<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> fullName<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><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: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> _fullName;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> fullName<span style="color: #000000;">&#40;</span>v<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: #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>
			_fullName = v;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> id<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><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: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> _id;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> id<span style="color: #000000;">&#40;</span>v<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: #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>
			_id = v;
		<span style="color: #000000;">&#125;</span>
&nbsp;
    	        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> email<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><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: #000000;">&#123;</span>
    		       <span style="color: #0033ff; font-weight: bold;">return</span> _email;
    	       <span style="color: #000000;">&#125;</span>
&nbsp;
    	       <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> email<span style="color: #000000;">&#40;</span>v<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: #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>
    		      _email = v;
    	       <span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> password<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><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: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> _password;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> password<span style="color: #000000;">&#40;</span>v<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: #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>
			_password = v;
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
</div>
</div>
<p>You can find the working application here <a href="http://www2.themorphicgroup.com/projects/celebrationEventList/" target="_blank">"CelebrationEvent"</a>. I am still adding more features and fixing some issues but the setup is the same. Check it out.</p>
<p style="margin-bottom: 0in;"><strong>Array to ArrayCollection</strong></p>
<p style="margin-bottom: 0in;">Just something to point out... One question comes to mind when working with AMFPHP and Flex... How to convert arrays in php to  ArrayCollection for Flex/Actionscript? I found the best idea for me was to convert the array within the result call.</p>
<p style="margin-bottom: 0in;" align="left"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #6699cc;"><strong>...</strong></span></span></span></p>
<p style="margin-bottom: 0in;" align="left"><span style="font-family: Courier New,monospace;"><span style="font-size: x-small;"><span style="color: #6699cc;"><strong>var</strong></span><span style="color: #000000;"> dataProvider:ArrayCollection = </span><span style="color: #0033ff;"><strong>new</strong></span><span style="color: #000000;"> ArrayCollection(event.result </span><span style="color: #0033ff;"><strong>as</strong></span><span style="color: #000000;"> Array);</span></span></span></p>
<p style="margin-bottom: 0in;">…</p>
<p style="margin-bottom: 0in;">For more on this subject check out this blog from <a href="http://wadearnold.com/blog/flash/amfphp/amfphp-arraycollection" target="_blank">Wade Arnald - AMFPHP ArrayCollection</a></p>
<p style="margin-bottom: 0in;"><strong>Conclusion</strong></p>
<p style="margin-bottom: 0in;">I can't praise Adobe enough with the improvement of the debugging process. Now you have a network monitor where you can see the data packet and inspect the request and response. You can set conditional breakpoints ..  Check out this video blog by<a href="http://www.iheartair.com/?p=322" target="_blank"> Jun Heider</a> (thanks Seth)</p>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;">The path from Illustrator file to Flash Catalyst to Flash Builder was pretty straight forward. I did have a few weird moments in Flash Catalyst.</p>
<ul>
<li>
<p style="margin-bottom: 0in;">I don't have Illustrator CS 4. So I 	couldn't edit any text or assets in Flash Catalyst. It would be nice to be 	able to have this functionality but I understand the push 	to most recent version of Adobe products.</p>
</li>
<li>
<p style="margin-bottom: 0in;">In Flash Catalyst, I wanted to change 	every component name to a logical naming convention. That didn't go 	so well. You can select the component in the library but there is no 	preview and no selection on the stage.</p>
</li>
<li>
<p style="margin-bottom: 0in;">Within Flash Catalyst, make sure you copy from the last 	state that you created when creating new states. I made some mistakes in a few tests assuming that I could copy through states. Not a good idea.</p>
</li>
<li>
<p style="margin-bottom: 0in;">The code that is generated when 	you import your Catalyst project to Flash Builder 4 is impressive 	but still bulky. A developer would still have a intense chore to 	wire it up the application properly. And with that … try to use a design pattern 	or established framework with what is given? One big Main class. I'm 	still scratching my head on what to do on that issue.</p>
</li>
</ul>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;">With all these criticisms I do understand that this is beta software... I will say that Flash Catalyst is a great tool to start putting the pieces together. In fact, I don't think I could start a Flex 4 (with Spark component) project without Flash Catalyst at the start. I have a lot of hope in the evolution of the Flash Platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/06/25/a-chat-about-php-with-flash-builder-4-and-adobe-catalyst/feed/</wfw:commentRss>
		<slash:comments>4</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>How to Create a Spark Icon Button and Skin</title>
		<link>http://www.themorphicgroup.com/blog/2009/06/18/how-to-create-a-spark-icon-button-and-skin/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/06/18/how-to-create-a-spark-icon-button-and-skin/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 18:39:29 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=83</guid>
		<description><![CDATA[With the new spark components in MXML 2009 you may have noticed there is not longer an "icon" style property you can set for a button. So what do you do if you want an icon in your button? One solution is to put the icon in your button skin, but this would require you [...]]]></description>
			<content:encoded><![CDATA[<p>With the new spark components in MXML 2009 you may have noticed there is not longer an "icon" style property you can set for a button. So what do you do if you want an icon in your button?</p>
<p>One solution is to put the icon in your button skin, but this would require you to build multiple skins for multiple icons.</p>
<p>Another solution is to use an Image component as a button. However, let's say we want to have different icons used for different rollover states. We could definitely use MouseEvent event listeners to switch the source property of the Image component. Unfortunately, transparent pixels in an image have been known to cause problems with MouseEvents firing properly. To avoid these type of pitfalls, we are going to create our own custom component by doing the following:<br />
<span id="more-83"></span></p>
<div><strong>Create a new IconButton class that extends spark.components.Button</strong></div>
<div>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> com.tmg.components
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> spark.components.Button;
&nbsp;
	<span style="color: #009900;">//icons</span>
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;iconUp&quot;</span>,<span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;*&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;iconOver&quot;</span>,<span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;*&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;iconDown&quot;</span>,<span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;*&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;iconDisabled&quot;</span>,<span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;*&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #009900;">//paddings</span>
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;paddingLeft&quot;</span>,<span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;Number&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;paddingRight&quot;</span>,<span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;Number&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;paddingTop&quot;</span>,<span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;Number&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;paddingBottom&quot;</span>,<span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;Number&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> IconButton extends Button
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> IconButton<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
</div>
<div>
<p>In this class we define Style Metadata tags to let Flash Builder know what styles are available for this component in addition to the default style properties of Button. With this component, we want the developer to be able to specify images for different states of the button. We also want to give the developer the ability to specify the padding around the elements of our button.</p>
</div>
<div><strong>Create a skin mxml component</strong></div>
<div>
<pre class="mxml" style="font-family:monospace;">&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SparkSkin</span></span>
<span style="color: #000000;">	xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">	xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">	xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span></span>
<span style="color: #000000;">	currentStateChanging=<span style="color: #ff0000;">&quot;onCurrentStateChanging(event)&quot;</span></span>
<span style="color: #000000;">	<span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Metadata</span><span style="color: #7400FF;">&gt;</span></span>
		[HostComponent(&quot;com.freckle.oceania.client.view.components.IconButton&quot;)]
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Metadata</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">			import mx.events.StateChangeEvent;</span>
&nbsp;
<span style="color: #000000;">			private function onCurrentStateChanging<span style="color: #66cc66;">&#40;</span>event:StateChangeEvent<span style="color: #66cc66;">&#41;</span>:void<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">				switch<span style="color: #66cc66;">&#40;</span>event.newState<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">					case <span style="color: #ff0000;">&quot;up&quot;</span>:</span>
<span style="color: #000000;">						setIcon<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconUp&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">						break;</span>
<span style="color: #000000;">					case <span style="color: #ff0000;">&quot;over&quot;</span>:</span>
<span style="color: #000000;">						setIcon<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconOver&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">						break;</span>
<span style="color: #000000;">					case <span style="color: #ff0000;">&quot;down&quot;</span>:</span>
<span style="color: #000000;">						setIcon<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconDown&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">						break;</span>
<span style="color: #000000;">					case <span style="color: #ff0000;">&quot;disabled&quot;</span>:</span>
<span style="color: #000000;">						setIcon<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;iconDisabled&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">						break;</span>
<span style="color: #000000;">				<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">			private function setIcon<span style="color: #66cc66;">&#40;</span>type:String<span style="color: #66cc66;">&#41;</span>:void<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">				if<span style="color: #66cc66;">&#40;</span>hostComponent.getStyle<span style="color: #66cc66;">&#40;</span>type<span style="color: #66cc66;">&#41;</span> != null<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">					icon.source = hostComponent.getStyle<span style="color: #66cc66;">&#40;</span>type<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">				<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BasicLayout</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:states</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;up&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;over&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;down&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:State</span> name=<span style="color: #ff0000;">&quot;disabled&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:states</span><span style="color: #7400FF;">&gt;</span></span> 
&nbsp;
 	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> left=<span style="color: #ff0000;">&quot;0&quot;</span> right=<span style="color: #ff0000;">&quot;0&quot;</span> top=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<span style="color: #ff0000;">&quot;0&quot;</span> width=<span style="color: #ff0000;">&quot;69&quot;</span> height=<span style="color: #ff0000;">&quot;20&quot;</span> radiusX=<span style="color: #ff0000;">&quot;2&quot;</span> radiusY=<span style="color: #ff0000;">&quot;2&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:stroke</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColorStroke</span> id=<span style="color: #ff0000;">&quot;outline&quot;</span> weight=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:stroke</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
        	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:LinearGradient</span><span style="color: #7400FF;">&gt;</span></span>
        		<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:GradientEntry</span> color=<span style="color: #ff0000;">&quot;#ffffff&quot;</span> ratio=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
        		<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:GradientEntry</span> color=<span style="color: #ff0000;">&quot;#cccccc&quot;</span> ratio=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
        	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:LinearGradient</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
 	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Group</span></span>
<span style="color: #000000;"> 		horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #000000;"> 		verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #000000;"> 		<span style="color: #7400FF;">&gt;</span></span>
 		<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
 			<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HorizontalLayout</span></span>
<span style="color: #000000;"> 				paddingBottom=<span style="color: #ff0000;">&quot;{ hostComponent.getStyle('paddingBottom')}&quot;</span></span>
<span style="color: #000000;"> 				paddingTop=<span style="color: #ff0000;">&quot;{ hostComponent.getStyle('paddingTop')}&quot;</span></span>
<span style="color: #000000;"> 				paddingLeft=<span style="color: #ff0000;">&quot;{ hostComponent.getStyle('paddingLeft')}&quot;</span></span>
<span style="color: #000000;"> 				paddingRight=<span style="color: #ff0000;">&quot;{ hostComponent.getStyle('paddingRight')}&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
 		<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
 		<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Image</span></span>
<span style="color: #000000;">	    	id=<span style="color: #ff0000;">&quot;icon&quot;</span></span>
<span style="color: #000000;">	    	source=<span style="color: #ff0000;">&quot;{hostComponent.getStyle('iconUp')}&quot;</span></span>
<span style="color: #000000;">	    	verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #000000;">	    	alpha=<span style="color: #ff0000;">&quot;{(this.currentState == 'up')?.5:1}&quot;</span></span>
<span style="color: #000000;">	    	<span style="color: #7400FF;">/&gt;</span></span>
	    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SimpleText</span></span>
<span style="color: #000000;">	    	text=<span style="color: #ff0000;">&quot;{hostComponent.label}&quot;</span></span>
<span style="color: #000000;">	    	verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #000000;">	    	includeInLayout=<span style="color: #ff0000;">&quot;{( hostComponent.label != '' )}&quot;</span></span>
<span style="color: #000000;">	    	visible=<span style="color: #ff0000;">&quot;{( hostComponent.label != '' )}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
 	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Group</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:SparkSkin</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;</pre>
</div>
<p>One of the first things you may notice is the Metadata tag declaring the Hostcomponent. This is important because it lets this skin component know what kind of component will be using this skin. Note the SimpleText component's text property is set to the hostComponent's label property.</p>
<p>Another key element to this piece of code is the event handler for when the state changes. As you may have guessed from the contents of the states tag, the hostComponent changes the state of this skin for the different button mouse states. By listening to this event, we can change the current source of the icon image component.</p>
<p>This brings us to our last step...</p>
<div><strong>Implement the new component</strong></div>
<div>
<pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;components:IconButton</span></span>
<span style="color: #000000;">		width=<span style="color: #ff0000;">&quot;100%&quot;</span></span>
<span style="color: #000000;">		iconUp=<span style="color: #ff0000;">&quot;assets/images/icons/toolbar/arrow_out.png&quot;</span></span>
<span style="color: #000000;">		iconDisabled=<span style="color: #ff0000;">&quot;assets/images/icons/toolbar/arrow_out_disabled.png&quot;</span></span>
<span style="color: #000000;">		fontFamily=<span style="color: #ff0000;">&quot;Times&quot;</span></span>
<span style="color: #000000;">		fontWeight=<span style="color: #ff0000;">&quot;bold&quot;</span></span>
<span style="color: #000000;">		skinClass=<span style="color: #ff0000;">&quot;com.tmg.skins.IconButtonSkin&quot;</span></span>
<span style="color: #000000;">		paddingLeft=<span style="color: #ff0000;">&quot;5&quot;</span></span>
<span style="color: #000000;">		paddingTop=<span style="color: #ff0000;">&quot;5&quot;</span></span>
<span style="color: #000000;">		paddingRight=<span style="color: #ff0000;">&quot;5&quot;</span></span>
<span style="color: #000000;">		paddingBottom=<span style="color: #ff0000;">&quot;5&quot;</span></span>
<span style="color: #000000;">		<span style="color: #7400FF;">/&gt;</span></span>
&nbsp;</pre>
</div>
<p>When implementing your own skins, be sure to set the skinClass property. In this implementation we just set the iconUp and iconDisabled properties. Because of how we wrote the set icon method in our skin, the skin will only use the icons that have been declared. As for the label, we have also coded the skin to not show the text component if the label text is empty, but in this case we do have a label.</p>
<div><strong>Summary</strong></div>
<p>So there you have it, a brand new component that uses the new MXML 2009 Spark architecture for skinning. With this new approach, we can break out our UI code into it's own file/component. A benefit of this new method is that we don't have much code in the actual component class. By using component skins, we can not only define the look via MXML but we can also add some logic/code. For example, it would be really easy to add a method that spins the icon on rollover or to change the text of label when disabled.</p>
<p>For more information about this, check out: <a href="https://xd.adobe.com/#/videos/video/165">https://xd.adobe.com/#/videos/video/165</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/06/18/how-to-create-a-spark-icon-button-and-skin/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Notes: Adding SEO to a Flex web site</title>
		<link>http://www.themorphicgroup.com/blog/2009/06/11/notes-adding-seo-to-a-flex-web-site/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/06/11/notes-adding-seo-to-a-flex-web-site/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 18:22:32 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Deep linking]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Meta]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[sitemap]]></category>
		<category><![CDATA[Yahoo]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=69</guid>
		<description><![CDATA[SEO or Search engine optimization is the skill set that helps market your web site/application. It is the process of improving the search results of a web site in popular search engines, such as Yahoo and Google. What it all comes down to is how your web content, text, is presented and referenced into searches. [...]]]></description>
			<content:encoded><![CDATA[<p>SEO or Search engine optimization is the skill set that helps market your web site/application. It is the process of improving the search results of a web site in popular search engines, such as Yahoo and Google. What it all comes down to is how your web content, text, is presented and referenced into searches.  This process allows the search engines to effectively index or parse through your<br />
web content.</p>
<p>Search engines use “spiders” (scripted site crawlers),  that runs through the hierarchy paths of your content, looking for patterns and associated links based on text. There are guidelines to be followed when formatting your web pages. <a href="http://www.google.com/support/webmasters/bin/answer.py?answer=35769" target="_new">Google has these guidelines defined out</a>. This is pretty straight forward for web sites that only consist of text. For Flash/Flex media, it is not so easy. Most of these “spiders” can't index into binary modules.</p>
<p>Recently Google has made strives in solving this <a href="http://googlewebmastercentral.blogspot.com/2008/06/improved-flash-indexing.html" target="_new">issue</a>. They have advanced the ability to index text in flash content. If all of your text content is embedded in your Flash/Flex media, your web content will be found in a search.</p>
<p>The problem  is that most flash/flex web applications keep the text content external to the actual application. This allows the ability to change text without recompiling the application. External files can not be properly indexed in search engines alone [UPDATE: As of June 18, Google will index external content - <a title="google" href="http://googlewebmastercentral.blogspot.com/2009/06/flash-indexing-with-external-resource.html" target="_blank">google</a>]. There are techniques to do this in a flash application. Kenny Bunch of Dreamsocket has a great article on <a href="http://dreamsocket.com/support/articles/seo/seo-flash" target="new">Flash SEO</a>.</p>
<p>In a typical Flex application, you may be using deeplinks for paging sections of your application and external text data. I will discuss a technique to improve the search results for Flex applications that have external text content with deeplink functionality. Note: For the most part, I am following <a href="http://www.google.com/support/webmasters/bin/answer.py?answer=35769" target="new">Google guidelines</a>.</p>
<h2>Example Solution - <a title="Flash SEO" href="http://www2.themorphicgroup.com/projects/FlashSEO/" target="_blank">"My Company"</a></h2>
<p>Let's evaluate the content section of a example flex application. My application has three major sections: Home, About Us, and Clients. The “About Us” section has two sub-section Mission Statement and Company Location. The “Portfolio” section has two subsections as well, “Client List” and “Projects”.</p>
<p>Here is the hierarchy of the "My Company" site:</p>
<ul>
<li>Home</li>
<li>About Us
<ul>
<li>Mission Statement</li>
<li>Company Location</li>
</ul>
</li>
<li>Portfolio
<ul>
<li>Client List</li>
<li>Projects</li>
</ul>
</li>
</ul>
<p>The company site has one page (index.html) that loads the Flex application(swf) and external files (xml, images, video, and stylesheet css). All of the text content for these sections are kept in external XML files.</p>
<p>In essence, we need to break out the sections into html pages. If possible, avoid duplication of content.</p>
<ul>
<li>Add a reference to the section in the title tag. This should always be unique on every page.</li>
<li>The <a href="http://en.wikipedia.org/wiki/Meta_tag" target="_blank">meta description and keyword attributes</a> needs a unique and descriptive text.</li>
<li>Each page needs to link to each other via a series of anchor html tags.</li>
<li>Most importantly it needs to contain the particular text content that would pertain to the each page section. This does involve manually copying particular section from the xml to each<br />
html page, preferably into div tags.</li>
</ul>
<p><a href="http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&amp;productId=2&amp;postId=9563" target="_blank">Deeplinks</a> are being used for paging ability. We need to make sure that the deeplink can be changed with the different page sections. Every page will reference the root of the site with the particular deeplink moniker. This way each page will open the correct section when it is found in the search. I will use javascript to direct the page deeplink back to the relative root.</p>
<p><code><em>document.location.href = "/#portfolio";</em></code></p>
<p>The search engine should ignore the javascript and parse or read the text content, the basis of the search text.</p>
<p><a title="Flash SEO" href="http://www2.themorphicgroup.com/projects/FlashSEO/" target="_blank">"My Company"</a> example illustrates this functionality (right click application page to see and download source). SwfObject is used to reference the swf. The meta description and keywords are very general examples. Your project may involve much more thought into what information is used. It needs to be very detailed and unique.</p>
<p>With my "My Company" solution, I created html pages based on SEO concepts that can reference the Flex application. It should work as if nothing changed. The goal is to reference particular text content of web application, improving the search ability of the web site.</p>
<p>This solution does have one drawback. The text content is not centralized. You anticipate constant (monthly or weekly) changes are made to the external data. It will need to be changed in the particular page that references that particular content.</p>
<p>So a further discussion would be: Could we dynamically generate html pages that with the external data used? Of course. One idea is to use a server-side language like php or ruby to generate the site like we did with the static html solution.</p>
<h2>Verification and Sitemap</h2>
<p>To verify that your site will be viewed as expected by search engines, it should be viewable regardless of having the flash player installed or javascript enabled. The best way to check this is to view the site in a barebones a text-mode web browser like Lynx.  This is a tool I used to check this: <a href="http://www.yellowpipe.com/yis/tools/lynx/lynx_viewer.php" target="_new">lynx viewer</a></p>
<p>Next, you will need to create a sitemap for referencing the content of your web application. For the "My Company" site I would created a sitemap with all of the html pages I found a great resource that automates the process: <a href="http://www.sitemaps.org/protocol.php">sitemaps.org</a>. It also has some great information about what the sitemap consists of and what each attribute means. For the "My Company" site, I would create a sitemap with all of the html pages referenced.</p>
<p>Now submit your sitemap to a popular search engines (you may need to create an account). It may take up to a week to see real results.<br />
Yahoo: <a href="https://siteexplorer.search.yahoo.com/submit" target="new">Site Explorer</a><br />
Google Web master tools: <a href="http://www.google.com/support/webmasters/bin/answer.py?answer=34575&amp;cbid=1k07ny5fup4ym&amp;src=cb&amp;lev=answer" target="new">Webmasters</a></p>
<p>Note: The usage of these sources are beyond the scope of this article. I have found that the google webmaster tools are great for monitoring the progress of this functionality.</p>
<h2>Summary</h2>
<p>In this article, I gave some tips and a possible solution for getting your flex application noticed by the most popular search engines. It does take some trial and error to see results. In one project, it took some weeks of tweeking to the content to find the right results. I hope this article is helpful to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/06/11/notes-adding-seo-to-a-flex-web-site/feed/</wfw:commentRss>
		<slash:comments>16</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>Paginated DataGrid with Sorting</title>
		<link>http://www.themorphicgroup.com/blog/2009/04/04/paginated-datagrid-with-sorting/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/04/04/paginated-datagrid-with-sorting/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 02:18:48 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[flex DataGrid pagination sorting]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=78</guid>
		<description><![CDATA[In a recent project we built a DataGrid that showed paginated data from a web service. That itself was pretty straight-forward. It eventually required sorting. And of course the sorting feature with DataGrid would only sort the data within a single page when we wanted the sorting to be applied to the entire data set. [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent project we built a DataGrid that showed paginated data from a web service. That itself was pretty straight-forward. It eventually required sorting. And of course the sorting feature with DataGrid would only sort the data within a single page when we wanted the sorting to be applied to the entire data set. So now what? To avoid writing a new DataGrid from scratch, I reread the docs and then dug into the source code ... something I find myself doing all the time. I found that the solution involved listening for and canceling an event and using 2 mx_internal variables.</p>
<p>To demonstrate the paginated sorting, I wrote up the following example that uses hard-coded data:<br />
<a href="http://www2.themorphicgroup.com/projects/examples/paginateddatagrid/" target="_new">PaginatedDataGridExample</a><br />
<a href="http://www2.themorphicgroup.com/projects/examples/paginateddatagrid/srcview/" target="_new">Source View</a></p>
<p>Click on the column headers to sort the data and see that the sorting is applied across the entire data set.</p>
<h3>Pagination</h3>
<p>The PaginatedDataGrid class uses the entireDataProvider property as input to contain the entire data set. The normal dataProvider property represents the data for each page. The bulk of the work is done by the populatePage() method:</p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> populatePage<span style="color: #000000;">&#40;</span>pageNum<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">int</span></a><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: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_entireDataProvider == <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">return</span>;
	<span style="color: #000000;">&#125;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">start</span><span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">int</span></a> = pageNum <span style="color: #000000; font-weight: bold;">*</span> pageSize;
	<span style="color: #6699cc; font-weight: bold;">var</span> end<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">int</span></a> = <span style="color: #004993;">start</span> <span style="color: #000000; font-weight: bold;">+</span> pageSize;
	end = <a href="http://www.google.com/search?q=math%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:math.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Math</span></a>.<span style="color: #004993;">min</span><span style="color: #000000;">&#40;</span>_entireCollection.<span style="color: #004993;">length</span>, end<span style="color: #000000;">&#41;</span>;
	_pageDataProvider.<span style="color: #004993;">splice</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">int</span></a> = <span style="color: #004993;">start</span>; i <span style="color: #000000; font-weight: bold;">&amp;</span>lt; end; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		_pageDataProvider.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>_entireCollection.getItemAt<span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
	<span style="color: #0033ff; font-weight: bold;">super</span>.dataProvider = _pageDataProvider;
	<span style="color: #009900;">// apply sorting that was lost due to dataProvider change</span>
	<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_savedSortDirection <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		sortIndex = _savedSortIndex;
		sortDirection = _savedSortDirection;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
<p>The properties page, pageCount, isFirstPage, and isLastPage are used by the application to navigate the PaginatedDataGrid:</p>
<pre class="actionscript3" style="font-family:monospace;">&nbsp;</pre>
<h3>Sorting</h3>
<p>We know from the Flex docs that the DataGrid dispatches the DataGridEvent.HEADER_RELEASE event. This event is dispatched by the mouseUpHandler() method in DataGridHeader and the event is cancelable. The PaginatedDataGrid listens for this event and handles it with the following method:</p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> headerReleaseHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span>DataGridEvent<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>
	event.<span style="color: #004993;">preventDefault</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	sortByColumn<span style="color: #000000;">&#40;</span>event.columnIndex<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre>
<p>The sortByColumn() method was largely copied from the sortByColumn() method from DataGrid. It determines how to sort and applies the sort information. It uses mx_internal properties so we had to import and use that namespace:</p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">import</span> mx.events.DataGridEvent;</pre>
<pre class="actionscript3" style="font-family:monospace;">use <span style="color: #004993;">namespace</span> mx_internal;</pre>
<p>The significant modifications to sortByColumn() are in the following lines:</p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900;">// save sort information to be applied when dataProvider changes</span>
_savedSortIndex = sortIndex;
_savedSortDirection = sortDirection;</pre>
<pre class="actionscript3" style="font-family:monospace;"> _entireCollection.<span style="color: #004993;">sort</span> = s;
 _entireCollection.refresh<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
populatePage<span style="color: #000000;">&#40;</span>page<span style="color: #000000;">&#41;</span>;</pre>
<p>Note that the sort is applied to  _entireCollection which is an ArrayCollection and whose source data is entireDataProvider. The current page is then repopulated with the newly sorted data.</p>
<h3>What if I'm using web services?</h3>
<p>If you want to modify PaginatedDataGrid to work with web services, you will not need a good chunk of the code starting with entireDataProvider. I would start by editing the page setter function which is the entry point of data population. If you're using sorting, you'll have to grab that data from sortIndex/sortDirection and pass them as parameters to the service (reformatted as necessary). If the feature requires additional filtering then you would create methods to set that information and then pass it along when requesting data for a page. This is a bit abstract I know. If you're comfortable with web services, then with this example you should have all the tools you'll need.</p>
<h3>Final Thoughts</h3>
<p>The more I read Flex source, the more I cry. Just kidding. I'm actually happy to find that between protected and mx_internal properties and methods, I'm able to customize (and fix) the code for my specific requirements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/04/04/paginated-datagrid-with-sorting/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Embeding Fonts for use in TextFormat and CSS</title>
		<link>http://www.themorphicgroup.com/blog/2009/03/20/embeding-fonts-for-use-in-textformat-and-css/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/03/20/embeding-fonts-for-use-in-textformat-and-css/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 19:07:17 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[embed]]></category>
		<category><![CDATA[FlexBuiler]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[registerFont]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[swf]]></category>
		<category><![CDATA[TextFormat]]></category>
		<category><![CDATA[ttf]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=76</guid>
		<description><![CDATA[I regularly have problems embedding fonts in my SWF files. There are a variety of different ways to embed fonts; many of which are detailed in the documentation. I am going to show my preferred way to embed fonts that solve many of the problems are arise when embedding fonts in other ways. One of the biggest issues that I [...]]]></description>
			<content:encoded><![CDATA[<p><span>I regularly have problems embedding fonts in my SWF files.  There are a variety of different ways to embed fonts; many of which are detailed in the documentation. <span> </span>I am going to show my preferred way to embed fonts that solve many of the problems are arise when embedding fonts in other ways.</span></p>
<p><span>One of the biggest issues that I have run into is making a font available for use in both a .css file and in a TextFormat object.<span> </span>It is difficult for me to reference a font that is embedded in a .css file from an AS3 code line that is setting the properties of a new TextFormat object, for instance. <span> </span>This solution also works with both projects that use the mx.core.* framework (a Flex Project) and also pure AS3 projects. <span> </span>This solution works with BitmapFonts like the ones you might find on <a href="http://www.fontsforflash.com/">http://www.fontsforflash.com/</a>.</span></p>
<p>The solution involves making a Fonts.as class that embeds the font definitions and registers them with the global Font object.  This enables referencing of fonts by name from anywhere within your application - CSS, AS3, or MXML files.  I like to make a Flex Library project to hold all the font information.  This allows me to use the same embed code for multiple project - and if desired - make the font.swc into an RSL for runtime sharing between multiple SWFs on your Web site.  You could potentially also achieve runtime loaded font definitions with this method - but that is a story for a different day.</p>
<h2><span><span style="color: #0000ff;"><strong><span style="color: #008000;">PART 1</span></strong><span style="color: #008000;"> - Make the</span></span><strong><span style="color: #0000ff;"><span style="color: #008000;"> font Flex Library Project</span></span></strong><span style="color: #0000ff;"><span style="color: #008000;"> project</span></span></span></h2>
<p><span><strong>Step 1</strong> – Open <strong>Flex Builder</strong> and make a new <strong>Flex Library Project</strong>.<span> </span>Name the project <strong>font</strong>.</span></p>
<p><span><strong>Step 2</strong> – Add font assets.<span> </span>I prefer to create a src/assets/fonts/ directory to hold my assets.<span> </span>The font assets can be either<br />
A) .TTF file<br />
B). SWF file by following the instructions from the docs found here: <a title="http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_09.html" href="http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_09.html" target="_blank">http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_09.html</a></span></p>
<p><span><strong>Step 3</strong> – Create a new .as file in your /src directory named <strong>Fonts.as</strong></span></p>
<p><strong>Step 4</strong> - Add this code to <strong>Fonts.as</strong></p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a>;
&nbsp;
	<span style="color: #3f5fbf;">/**
	 *  This class sets up the fonts for the application.
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Fonts
	<span style="color: #000000;">&#123;</span>
	<span style="color: #009900;">// Embed a TTF file</span>
        <span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/BOOTLE__.TTF'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'BOOTLE'</span>, mimeType=<span style="color: #990000;">'application/x-font'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> <span style="color: #009900;">// http://famousfonts.smackbomb.com/fonts/thebeatles.php</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> BOOTLE<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
        <span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/squealer.TTF'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'Squealer'</span>, mimeType=<span style="color: #990000;">'application/x-font'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> <span style="color: #009900;">// http://famousfonts.smackbomb.com/fonts/acdc.php</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> Squealer<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
        <span style="color: #009900;">// Embed a font located inside a SWF file</span>
        <span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/embededFonts.swf'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'Frutiger LT 45 Light'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> FrutigerLT45Light<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
	<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/embededFonts.swf'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'Frutiger LT 45 Light'</span>, fontWeight=<span style="color: #990000;">'bold'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> FrutigerLT45LightBold<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
	<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/embededFonts.swf'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'Frutiger LT 45 Light'</span>, <span style="color: #004993;">fontStyle</span>=<span style="color: #990000;">'italic'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> FrutigerLT45LightItalic<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
	<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">'assets/fonts/embededFonts.swf'</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">'Frutiger LT 45 Light'</span>, fontWeight=<span style="color: #990000;">'bold'</span>, <span style="color: #004993;">fontStyle</span>=<span style="color: #990000;">'italic'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #6699cc; font-weight: bold;">var</span> FrutigerLT45LightBoldItalic<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=class%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:class.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Class</span></a>;
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * Constuctor
		 */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Fonts<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900;">// Register the font with the global Font manager class</span>
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>BOOTLE<span style="color: #000000;">&#41;</span>;
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>Squealer<span style="color: #000000;">&#41;</span>;
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>FrutigerLT45Light<span style="color: #000000;">&#41;</span>;
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>FrutigerLT45LightBold<span style="color: #000000;">&#41;</span>;
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>FrutigerLT45LightItalic<span style="color: #000000;">&#41;</span>;
			<a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>FrutigerLT45LightBoldItalic<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * A utility function
		 *
		 * @param font	A font object
		 * @return 	A sting of the font name combined with the font style
		 */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> getUniqueFontName<span style="color: #000000;">&#40;</span><span style="color: #004993;">font</span><span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=font%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:font.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Font</span></a><span style="color: #000000;">&#41;</span><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: #000000;">&#123;</span>
            		<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">font</span>.<span style="color: #004993;">fontName</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;:&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">font</span>.<span style="color: #004993;">fontStyle</span>;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #009900;">// A convienent place to declare TextFormat objects that will be used in multiple location</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat1<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Squealer&quot;</span>, <span style="color: #000000; font-weight:bold;">12</span>, 0x000000<span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat2<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;BOOTLE&quot;</span>, <span style="color: #000000; font-weight:bold;">12</span>, 0x000000<span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat3<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>, <span style="color: #000000; font-weight:bold;">14</span>, 0x000000<span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat3Bold<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>, <span style="color: #000000; font-weight:bold;">14</span>, 0x000000, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat3Italic<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>, <span style="color: #000000; font-weight:bold;">14</span>, 0x000000, <span style="color: #0033ff; font-weight: bold;">null</span>, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #6699cc; font-weight: bold;">var</span> textFormat3BoldItalic<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>, <span style="color: #000000; font-weight:bold;">14</span>, 0x000000, <span style="color: #0033ff; font-weight: bold;">true</span>, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
<h2><span><span style="color: #0000ff;"><span style="color: #008000;">PART 2 – Make a project(s) that will use the </span></span><strong><span style="color: #0000ff;"><span style="color: #008000;">font Flex Library Project</span></span></strong></span></h2>
<p><span><strong>- AS3 PROJECT</strong> –<br />
<strong>Step 1</strong> - Create a new <strong>ActionScript Project</strong><span>  </span>(File --&gt;</span><span> New --&gt;</span><span> ActionScript Project)</span></p>
<ul>
<li>Name the project <strong>AS3FontTest</strong></li>
<li>Click<strong> Next </strong>button</li>
<li>Click <strong>Library Path</strong> tab</li>
<li>Click <strong>Add Project </strong>button</li>
<li>Select<strong> font </strong>and click<strong> OK</strong></li>
<li>Click<strong> Finish </strong>button</li>
</ul>
<p><strong></strong></p>
<p><strong> </strong><br />
<strong>Step 2</strong> - Add this code to the AS3FontTest.as file</p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Sprite</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<a href="http://www.google.com/search?q=stagealign%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagealign.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">StageAlign</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<a href="http://www.google.com/search?q=stagescalemode%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagescalemode.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">StageScaleMode</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=antialiastype%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:antialiastype.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">AntiAliasType</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=gridfittype%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:gridfittype.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">GridFitType</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextField</span></a>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a>;
&nbsp;
	<span style="color: #009900;">// Use meta-data to set the height and width of the SWF</span>
	<span style="color: #000000;">&#91;</span>SWF<span style="color: #000000;">&#40;</span><span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;200&quot;</span>, <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;200&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 *  Class used to test embeded font
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> AS3FontTest extends <a href="http://www.google.com/search?q=sprite%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:sprite.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">Sprite</span></a>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> tf<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextField</span></a>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> yPos<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">int</span></a> = <span style="color: #000000; font-weight:bold;">0</span>;
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * Constructor
		 */</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> AS3FontTest<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #009900;">// Set some SWF paramaters</span>
			<span style="color: #004993;">stage</span>.<span style="color: #004993;">scaleMode</span> = <a href="http://www.google.com/search?q=stagescalemode%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagescalemode.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">StageScaleMode</span></a>.<span style="color: #004993;">NO_SCALE</span>;
			<span style="color: #004993;">stage</span>.<span style="color: #004993;">align</span> = <a href="http://www.google.com/search?q=stagealign%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:stagealign.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">StageAlign</span></a>.<span style="color: #004993;">TOP_LEFT</span>;
&nbsp;
			<span style="color: #009900;">// Draw the text</span>
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat1<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// Use the static instance of a TextFormat object from the Fonts.as class</span>
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat2<span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat3<span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat3Bold<span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat3Italic<span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>Fonts.textFormat3BoldItalic<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * Method used to draw the UI bits and attach them to the screen
		 */</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>textFormat<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><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>
			tf = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextField</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			tf.<span style="color: #004993;">defaultTextFormat</span> = textFormat;
			tf.<span style="color: #004993;">embedFonts</span> = <span style="color: #0033ff; font-weight: bold;">true</span>;
			tf.<span style="color: #004993;">antiAliasType</span> = <a href="http://www.google.com/search?q=antialiastype%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:antialiastype.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">AntiAliasType</span></a>.<span style="color: #004993;">ADVANCED</span>; <span style="color: #009900;">// Set this to what looks best for your font</span>
			tf.<span style="color: #004993;">thickness</span> = <span style="color: #000000; font-weight:bold;">0</span>; <span style="color: #009900;">// Set this to what looks best for your font</span>
			tf.<span style="color: #004993;">sharpness</span> = <span style="color: #000000; font-weight:bold;">0</span>; <span style="color: #009900;">// Set this to what looks best for your font</span>
			tf.<span style="color: #004993;">gridFitType</span> = <a href="http://www.google.com/search?q=gridfittype%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:gridfittype.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">GridFitType</span></a>.<span style="color: #004993;">SUBPIXEL</span>; <span style="color: #009900;">// Set this to what looks best for your font</span>
			tf.<span style="color: #004993;">x</span> = <span style="color: #000000; font-weight:bold;">10</span>;
			tf.<span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">10</span> <span style="color: #000000; font-weight: bold;">+</span> yPos;
			tf.<span style="color: #004993;">width</span> = <span style="color: #000000; font-weight:bold;">180</span>;
			tf.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;ABC123&quot;</span>;
&nbsp;
			<span style="color: #009900;">// Add the created TextField to the stage</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</span>;
&nbsp;
			yPos <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #000000; font-weight:bold;">18</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
<p><strong>Step 3</strong> - Run the project and you should see the embedded font(s) as expected<strong></strong></p>
<p><span><strong>- FLEX PROJECT –</strong><br />
<strong>Step 1</strong> - Create a new <strong>Flex Project <span><span style="font-weight: normal;">(File --&gt;</span></span><span><span style="font-weight: normal;"> New --&gt;</span></span><span><span style="font-weight: normal;"> ActionScript Project)</span></span></strong></span></p>
<ul>
<li>Name the project <strong>FlexFontTest</strong></li>
<li>Click <strong>Next </strong>button</li>
<li>Click <strong>Library Path</strong> tab</li>
<li>Click <strong>Add Project</strong> button</li>
<li>Select <strong>font </strong>and click <strong>OK</strong></li>
<li>Click <strong>Finish </strong>button</li>
</ul>
<p><span><strong>Step 2 -</strong> Make a new directory <strong>/src/assets/styles</strong></span></p>
<p><span><strong>Step 3</strong> -  Make a new CSS file in that directory named <strong>styles.css</strong><br />
<strong>Step 4</strong> -  Add this code to <strong>styles.css</strong></span></p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/* CSS file */</span>
.bootle <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;BOOTLE&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span>
.squealer <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;Squealer&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span>
.frutiger <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span>
.frutigerBold <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    font<span style="color: #000000; font-weight: bold;">-</span>weight<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">bold</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span>
.frutigerItalic <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    font<span style="color: #000000; font-weight: bold;">-</span>style<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">italic</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span>
.frutigerBoldItalic <span style="color: #000000;">&#123;</span>
    fontFamily<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>;
    font<span style="color: #000000; font-weight: bold;">-</span><span style="color: #004993;">size</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #000000; font-weight:bold;">12</span>;
    font<span style="color: #000000; font-weight: bold;">-</span>weight<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">bold</span>;
    font<span style="color: #000000; font-weight: bold;">-</span>style<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">italic</span>;
    <span style="color: #004993;">color</span><span style="color: #000000; font-weight: bold;">:</span> #000000;
<span style="color: #000000;">&#125;</span></pre>
<p><strong>Step 5</strong> -  Add this code to the <strong>FlexFontText.mxml </strong>file that was created when you made the project<br />
<code></p>
<pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application xmlns<span style="color: #000000; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #990000;">&quot;absolute&quot;</span>
	creationComplete=<span style="color: #990000;">&quot;created()&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>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;">private</span> <span style="color: #339966; font-weight: bold;">function</span> created<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: #009900;">// Instantiate the Fonts class</span>
				<span style="color: #0033ff; font-weight: bold;">new</span> Fonts<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
				<span style="color: #009900;">// Reference the embeded font name by it's string name</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> tf<span style="color: #000000; font-weight: bold;">:</span><a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextField</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textfield%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textfield.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextField</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
				tf.<span style="color: #004993;">defaultTextFormat</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=textformat%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:textformat.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">TextFormat</span></a><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Frutiger LT 45 Light&quot;</span>, <span style="color: #000000; font-weight:bold;">12</span>, 0x000000<span style="color: #000000;">&#41;</span>;
				tf.<span style="color: #004993;">embedFonts</span> = <span style="color: #0033ff; font-weight: bold;">true</span>;
				tf.<span style="color: #004993;">antiAliasType</span> = <a href="http://www.google.com/search?q=antialiastype%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:antialiastype.html&amp;filter=0&amp;num=100&amp;btnI=lucky"><span style="color: #004993;">AntiAliasType</span></a>.<span style="color: #004993;">ADVANCED</span>;
				tf.<span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;ABC 123&quot;</span>;
&nbsp;
				fontHolder.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</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>mx<span style="color: #000000; font-weight: bold;">:</span>Script<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Style <span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;/assets/styles/styles.css&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>VBox <span style="color: #004993;">x</span>=<span style="color: #990000;">&quot;10&quot;</span> <span style="color: #004993;">y</span>=<span style="color: #990000;">&quot;10&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>UIComponent id=<span style="color: #990000;">&quot;fontHolder&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;20&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;bootle&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;squealer&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;frutiger&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;frutigerBold&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;frutigerItalic&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>mx<span style="color: #000000; font-weight: bold;">:</span>Text styleName=<span style="color: #990000;">&quot;frutigerBoldItalic&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;ABC 123&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>VBox<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;/</span>mx<span style="color: #000000; font-weight: bold;">:</span>Application<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;</pre>
<p></code></p>
<p><span><strong>Step 6</strong> - Run the project and you should see the embedded font(s)</span></p>
<p><span>I hope this illustrated a way to simplify font embedding in Flash that allows for use in TextFormat object or in CSS files.</span></p>
<p><span>--jason</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/03/20/embeding-fonts-for-use-in-textformat-and-css/feed/</wfw:commentRss>
		<slash:comments>1</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>
	</channel>
</rss>
