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

<channel>
	<title>The Morphic Group &#187; Flash Builder</title>
	<atom:link href="http://www.themorphicgroup.com/blog/tag/flash-builder/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>&#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>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>
	</channel>
</rss>
