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

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

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=331</guid>
		<description><![CDATA[Here is a work around for this annoying bug in Flash Builder 4 beta 2: From: http://bugs.adobe.com/jira/browse/FB-21566 Close Flash Builder 4 beta 2 Delete this folder in your workspace: \.metadata\.plugins\com.adobe.flexbuilder.codemodel. Relaunch Flash Builder 4 beta 2]]></description>
			<content:encoded><![CDATA[<p>Here is a work around for this annoying bug in Flash Builder 4 beta 2:</p>
<p>From: http://bugs.adobe.com/jira/browse/FB-21566</p>
<p>Close Flash Builder 4 beta 2</p>
<p>Delete this folder in your workspace:</p>
<p><workspace root>\.metadata\.plugins\com.adobe.flexbuilder.codemodel.</p>
<p>Relaunch Flash Builder 4 beta 2</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/10/27/content-assist-did-not-complete-normally/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>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>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>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>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>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>The Morphic Group &#8216;Indycar Race Control&#8217;</title>
		<link>http://www.themorphicgroup.com/blog/2009/06/08/82/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/06/08/82/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 17:56:10 +0000</pubDate>
		<dc:creator>Sam Roach</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Conviva]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[indy racing]]></category>
		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=82</guid>
		<description><![CDATA[The Morphic Group along with Conviva and Indy Race League is proud to present their latest creation, Indycar Race Control: Indycar Race Control is a fully immersive way to experience Indy Racing. Not only can you watch the live race or in-car video but you can monitor each car's telemetry data. Here are just some [...]]]></description>
			<content:encoded><![CDATA[<p>The Morphic Group along with Conviva and Indy Race League is proud to present their latest creation, Indycar Race Control:</p>
<p><a href="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/09/tmgindy.jpg"><img src="http://www.themorphicgroup.com/blog/wp-content/uploads/2009/09/racecontrol300.png" border="none" alt="" width="361" height="275" /></a></p>
<p>Indycar Race Control is a fully immersive way to experience Indy Racing. Not only<br />
can you watch the live race or in-car video but you can monitor each car's<br />
telemetry data. Here are just some of the features:</p>
<ul>
<li>Live race and in-car video (up to 5 simultaneous videos)</li>
<li>Real-time car telemetry (speed, throttle, RMP, steering, etc)</li>
<li>Switch any in-car camera to full view and listen to driver &amp; pit crew</li>
<li>Race standings and scoring</li>
<li>Configurable driver 'pods' allowing individually drivers to be tracked</li>
<li>Customizable layouts</li>
<li>2 driver compete mode</li>
<li>Fullscreen mode</li>
</ul>
<p>Indy Race Control is only available during live Indy Races, please visit <a href="http://downforce.indycar.com/racecontrol/" target="_blank"><strong>indycar.com</strong></a><br />
for more information on race dates.</p>
<h2>Indycar Race Control Technical Details</h2>
<p>Indy Race Control is an Adobe Flex application created by The Morphic Group that receives<br />
live streaming video and live telemetry data from the race track during a race.</p>
<p><strong>Race &amp; in-car video</strong><br />
During an Indy car race live video and in-car video are encoded and redistributed from a<br />
Flash Video CDN. Each video stream is encoded at multiple sizes. The Indy Race Control<br />
Flex client is given information on which cars have in-car video and which is the main<br />
video feed. The client allows any of the in-car videos to be switch from the small viewer<br />
to the main viewer.</p>
<p><strong>Real-time race car telemetry</strong><br />
Each car's live telemetry data is acquired by a cluster of Wowza servers. The Indy Race<br />
Control Flex client connects to a Wowza server via a load balanced cluster living on<br />
Amazon EC2. After connecting the client receives real-time race car telemetry data.<br />
The Morphic Group create a Wowza based application that can scale to multiple<br />
thousands of simulations clients.</p>
<p><strong>Video Statistics</strong><br />
Conviva's LivePass gives Indy Racing the ability to  	view real-time statistics of video<br />
streams being watched with the Indy Race Control.</p>
<p><strong>Indy Racing Control Flex Client</strong><br />
The user interface was created by The Morphic Group using Adobe Flex. This Flex based<br />
client provides the race fan with a huge amount of information displayed in friendly<br />
and useful way. The user can customize the application to meet their needs. Specific<br />
drivers and/or videos can be selected, and these custom layous can be saved.</p>
<p>Visit <a href="http://downforce.indycar.com/racecontrol/" target="_blank"><strong>indycar.com</strong></a> to view Indy Race Control during races.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/06/08/82/feed/</wfw:commentRss>
		<slash:comments>1</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>
		<item>
		<title>Disable Caching In Firefox</title>
		<link>http://www.themorphicgroup.com/blog/2009/03/09/disable-caching-in-firefox/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/03/09/disable-caching-in-firefox/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 19:45:00 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex Builder]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=75</guid>
		<description><![CDATA[This is a silly post. I'm going to write something that probably everyone else in the whole Flex world already knows. But I didn't know this. And it was helpful for me. For a project I'm working on we are having to integrate a feature that uses a .swc provided by the client. This feature, [...]]]></description>
			<content:encoded><![CDATA[<p>This is a silly post. I'm going to write something that probably everyone else in the whole Flex world already knows. But I didn't know this. And it was helpful for me.</p>
<p>For a project I'm working on we are having to integrate a feature that uses a .swc provided by the client. This feature, which we are merely integrating and didn't have technical control over the implementation, requires that the Flex application run from a Web server (from an http directive, not from a file directive) in the browser or it won't work. I thought that was annoying, but I realized just how annoying it really was after I ran it from Apache (which I just installed on my machine for this purpose) and my new trace statements didn't show up. After a few minutes I realized it was because the .swf was cached by Firefox. I could clear the cache every time just before running the application. But that was not a very workable solution. instead, I wanted to disable caching entirely.</p>
<p>The way I found to disable caching from Firefox is to run Firefox and in the address bar type about:config. This will take you to a page with a datagrid and a bunch of configuration settings for Firefox. I set browser.cache.disk.enable and browser.cache.memory.enable both to false.</p>
<p>That was all I had to do to disable caching. Oh, and it does occur to me that I *could* have customized the .html template FlexBuilder is using in order to load the .swf with a unique query string value each time, which would have solved the caching issue in a different way. But disabling caching in Firefox entirely seemed far more silly. Plus, it required far less work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/03/09/disable-caching-in-firefox/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Example of Feature Rich Dynamic Item Renderers in Flex 3</title>
		<link>http://www.themorphicgroup.com/blog/2009/02/20/example-of-feature-rich-dynamic-item-renderers-in-flex-3/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/02/20/example-of-feature-rich-dynamic-item-renderers-in-flex-3/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 17:43:37 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[itemrenderer]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=62</guid>
		<description><![CDATA[In the last Flex 3 rich feature item renderer example we looked at item renderers that had some nice visual and functional features, in this example we will take it to the next step and introduce some dynamic abilities to the item renderers. By using dynamic item renderers you can create more flexible &#38; reusable [...]]]></description>
			<content:encoded><![CDATA[<p>
	In the <a href="http://www.themorphicgroup.com/blog/2008/09/15/example-of-feature-rich-itemrenderers-in-flex/">last Flex 3 rich feature item renderer example</a> we looked at item renderers that had some nice visual and functional features, in this example we will take it to the next step and introduce some dynamic abilities to the item renderers. </p>
<p>    By using dynamic item renderers you can create more flexible &amp; reusable itemrenderers, you can also do neat stuff like pass callback functions to handle events in the itemrenderer.</p>
<p>
	Here are some of the things this dynamic item renderer example will demonstrate:
</p>
<ul>
<li>Reuse the same item renderer for a DataGrid and a List, each with a different data provider</li>
<li>Pass delete/click function into item renderer</li>
<li>Dynamically change icons</li>
<li>Dynamically change the label function</li>
<li>Set label title style</li>
</ul>
<p>  <a href="http://www.leavethatthingalone.com/examples/flex/itemrenderer02"><img src="http://www.leavethatthingalone.com/examples/flex/itemrenderer02/itemrenderer_02_post.png" width="200" height="105" alt="" border="0" /></a><br />
	<br />
    <a href="http://www.leavethatthingalone.com/examples/flex/itemrenderer02"><strong>View Example</strong> (right click for source)</a>
</p>
<p>In this post we won't go over every detail of the code, so check out the source in the example. </p>
<p>To start of with the basics, here is how to setup a  itemrenderer using  ClassFactory:</p>
<pre>
private var personItemRendererFactory:ClassFactory;
private function onInitialize():void {
	personItemRendererFactory = new ClassFactory(MyItemRenderer);
	peopleColumn.itemRenderer = personItemRendererFactory;
}
...
&lt;mx:DataGrid id=&quot;peopleDataGrid&quot; dataProvider=&quot;{peopleDataProvider}&quot;&gt;
	&lt;mx:columns&gt;
		&lt;mx:DataGridColumn id="peopleColumn" /&gt;
	&lt;/mx:columns&gt;
&lt;/mx:DataGrid&gt;
</pre>
<p>The example above doesn't really do much more than setting in itemrenderer in the DataGrid tag itself would, so lets set a property of the itemrenderer:</p>
<pre>
private function onInitialize():void {
	personItemRendererFactory = new ClassFactory(MyItemRenderer);
	personItemRendererFactory.properties = {doStuff: true};
	peopleColumn.itemRenderer = personItemRendererFactory;
}
</pre>
<p>
In the above example we are now creating an itemrenderer and setting the 'doStuff' property using the ClassFactory properties object. Using the class factory properties we can set many things at once including functions. Let's say we want  to listen for a click event inside the itemrenderer we can pass in a callback function that gets called from the item renderer when clicked:
</p>
<pre>
private function onInitialize():void {
	personItemRendererFactory = new ClassFactory(MyItemRenderer);
	personItemRendererFactory.properties = {clickFunction: itemrendererClick_handler};
	peopleColumn.itemRenderer = personItemRendererFactory;
}

private function itemrendererClick_handler(evt:MouseEvent):void {
	Alert.show('clicked');
}

/* this in item renderer */
//inside the itemrenderer we need to define the click function
public var clickFunction:Function;

//and then for this example lets call the clickFunction when the canvas is clicked
&lt;mx:Canvas click=&quot;clickFunction(event)&quot;...
</pre>
<p>
	The above example allows a function to set on the itemrenderer. When the itemrenderer is clicked the event is handled in the same component that the holds DataGrid, this can be very convenient.</p>
<p>When using the properties of ClassFactory there is a something to be aware of; your itemrenderer may require a property to be set, but the ClassFactory and properties will not enforce that property to be required. For example if a click handler function is required in the ItemRenderer but not set in the properties there will be a runtime error when the ItemRenderer is clicked.</p>
<p>
	View the example and right click for source to see<br />
	more details on how to do things like dynamically change icons and label functions.<br />
	<a href="http://www.leavethatthingalone.com/examples/flex/itemrenderer02"><strong>View Example</strong> (right click for source)</a>
</p>
<p>This example is not intended to be a best practices for the most efficient item renderers, for further reading: <a href="http://www.adobe.com/devnet/flex/articles/itemrenderers_pt5_print.html">Efficient Item Renderers</a>,  <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=ascomponents_advanced_3.html">Advanced visual components</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/02/20/example-of-feature-rich-dynamic-item-renderers-in-flex-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Slider Track Click And Drag</title>
		<link>http://www.themorphicgroup.com/blog/2009/01/07/slider-track-click-and-drag/</link>
		<comments>http://www.themorphicgroup.com/blog/2009/01/07/slider-track-click-and-drag/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 05:43:02 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.themorphicgroup.com/blog/?p=64</guid>
		<description><![CDATA[The default Flex Slider component allows you to click the track to update the thumb position but does not begin the dragging of the thumb. I wanted that drag behavior but didn't want to write my own Slider from scratch. I love to read code so I looked at the mx source and found a [...]]]></description>
			<content:encoded><![CDATA[<p>The default Flex Slider component allows you to click the track to update the thumb position but does not begin the dragging of the thumb. I wanted that drag behavior but didn't want to write my own Slider from scratch. I love to read code so I looked at the mx source and found a simple way to add that functionality in a Slider subclass.</p>
<p>In mx.controls.sliderClasses.Slider, there is a trackHitArea var who's mouseDown events are registered to a track_mouseDownHandler() method. That private method has all the logic to update the position of the  thumb. But for dragging, that is initiated by the thumb (SliderThumb class), not the trackHitArea.</p>
<p><a href="http://www2.themorphicgroup.com/projects/examples/slidertrackclickanddrag/" target="_blank">Click here for a small app that shows the original Slider and the new Slider subclass side-by-side.</a> Right-click for source.</p>
<p>I ended up replicating the track_mouseDownHandler() method and changing the end of the logic to dispatch the mouseDown event through the thumb object itself to initiate dragging (and maintain the original dragging behavior as if you clicked directly on the thumb). Luckily there were enough public/protected/mx_internal namespaced methods to maintain the same logic from the original track_mouseDownHandler(). I also added an allowTrackClickDragSliderThumb Boolean to be able to maintain the original track click behavior.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2009/01/07/slider-track-click-and-drag/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Deconstruction and reconstruction of a ByteArray</title>
		<link>http://www.themorphicgroup.com/blog/2008/12/02/deconstruction-and-reconstruction-of-a-bytearray/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/12/02/deconstruction-and-reconstruction-of-a-bytearray/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 17:59:57 +0000</pubDate>
		<dc:creator>Unknown Morphician</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ByteArray]]></category>
		<category><![CDATA[Flash]]></category>

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

var tempByteArray:ByteArray;

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

if(bytes.length &gt; byteLimit){

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

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

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

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

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

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

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

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

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

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

      byteArraySnapShot = null;
   }

}

</code>
</pre>
<p>There perhaps a few ways to achieve the functionality.  My purpose here is to show the process of reading and writing ByteArray in a real world application set. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.themorphicgroup.com/blog/2008/12/02/deconstruction-and-reconstruction-of-a-bytearray/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Example of Feature Rich ItemRenderers in Flex</title>
		<link>http://www.themorphicgroup.com/blog/2008/09/15/example-of-feature-rich-itemrenderers-in-flex/</link>
		<comments>http://www.themorphicgroup.com/blog/2008/09/15/example-of-feature-rich-itemrenderers-in-flex/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 22:00:39 +0000</pubDate>
		<dc:creator>Seth</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[itemrenderer]]></category>

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

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