﻿<?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>Keith Hair &#187; Flex</title>
	<atom:link href="http://keith-hair.net/blog/tag/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://keith-hair.net/blog</link>
	<description>Scripting is fun like any other hobby</description>
	<lastBuildDate>Mon, 17 May 2010 16:02:22 +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>I&#8217;m Testing Foam physics in Flex</title>
		<link>http://keith-hair.net/blog/2009/08/01/im-testing-foam-physics-in-flex/</link>
		<comments>http://keith-hair.net/blog/2009/08/01/im-testing-foam-physics-in-flex/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 05:49:35 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[Foam]]></category>
		<category><![CDATA[Physics Engine]]></category>
		<category><![CDATA[Polygons]]></category>

		<guid isPermaLink="false">http://keith-hair.net/blog/?p=105</guid>
		<description><![CDATA[There are a lot of Flash physics engines available to use. I've only tried Box2D, APE, and Foam. Foam is my favorite so far. I actually like the options of Box2D better but it's just not as ActionScript-friendly as Foam. Foam sets up the easiest of these 3 engines for an ActionScript only project...In my [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of Flash physics engines available to use. I've only tried Box2D, APE, and Foam.<br />
<a href="http://drawlogic.com/2007/11/07/as3-foam-2d-physics-engine/">Foam </a>is my favorite so far. I actually like the options of Box2D better but it's just not as ActionScript-friendly as Foam. </p>
<p>Foam sets up the easiest of these 3 engines for an ActionScript only project...In my opinion, setting it up to use in my Flex projects takes a little more work depending on what I use it for. Seeing the end result of it is fun to watch.</p>
<p>Below I'm currently using my <a href="/blog/examples/polygon_physics/">polygon editor</a> to test Foam out in Flex.</p>
<p><a href="http://keith-hair.net/blog/examples/polygon_physics/"><img src="/blog/examples/polygon_physics/physics_polygons.jpg" alt="Click to view example" /></a></p>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2009/08/01/im-testing-foam-physics-in-flex/&ztz=I\'m Testing Foam physics in Flex'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2009/08/01/im-testing-foam-physics-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Letting DisplayObjects Find the Main WindowedApplication in AIR</title>
		<link>http://keith-hair.net/blog/2009/04/30/letting-displayobjects-find-the-main-windowedapplication-in-air/</link>
		<comments>http://keith-hair.net/blog/2009/04/30/letting-displayobjects-find-the-main-windowedapplication-in-air/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 20:48:59 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Cursor]]></category>
		<category><![CDATA[WindowedApplication]]></category>

		<guid isPermaLink="false">http://keith-hair.net/blog/?p=29</guid>
		<description><![CDATA[Here is a way to let a DisplayObject find the main WindowedApplication on its own... In my AIR application I have other AIR Windows floating over the main AIR Window. I wanted one of my UIComponents to be draggable like a cursor, but when my mouse dragged the object over the other floating windows I [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a way to let a DisplayObject find the main WindowedApplication on its own...</p>
<p>In my AIR application I have other AIR Windows floating over the main AIR Window.<br />
I wanted one of my UIComponents to be draggable like a cursor, but when my mouse dragged the object<br />
over the other floating windows I wanted my original cursor to show again and hide my dragged UIComponent.</p>
<p>The reason behind this is if I wanted to apply "context sensitive" behaviors depending on what or which window the mouse is in.</p>
<p>To do this, the main WindowedApplication needed some ROLL_OUT and ROLL_OVER events added to it to detect when the mouse rolls in and out.<br />
The "getAIRAppWindow" method below finds the main WindowedApplication so I can add the listeners to it from there.</p>
<p>Here are some snippets explaining what I did:</p>
<p><span id="more-29"></span></p>
<p><strong>The method needed to find main WindowedApplication</strong></p>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">/*----------------------------------------------------------
Finds the main WindowedApplication of an AIR application
from any UIComponent and returns it.
------------------------------------------------------------*/</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getAIRAppWindow<span style="color: #66cc66;">&#40;</span>p:DisplayObjectContainer<span style="color: #66cc66;">&#41;</span>:WindowedApplication
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> c:*=p;
	<span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>c.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>c is WindowedApplication<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
					<span style="color: #b1b100;">return</span> WindowedApplication<span style="color: #66cc66;">&#40;</span>c<span style="color: #66cc66;">&#41;</span>;
				<span style="color: #66cc66;">&#125;</span>
			c=c.<span style="color: #006600;">parent</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p><strong><br />
Adding events to detect mouse in main Windowed Application</strong></p>
<pre class="actionscript">&nbsp;
_windowedApp=getAIRAppWindow<span style="color: #66cc66;">&#40;</span>parent<span style="color: #66cc66;">&#41;</span>;
&nbsp;
_windowedApp.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">ROLL_OUT</span>,__onMouseOutWorkSpace<span style="color: #66cc66;">&#41;</span>;
_windowedApp.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">ROLL_OVER</span>,__onMouseInWorkSpace<span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p><strong><br />
Example of actions to apply on ROLL_OUT and ROLL_OVER</strong></p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> __onMouseOutWorkSpace<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">/*--------------------------------------------------------
	When your mouse rolls out of the main WindowedApplication
	(and into other nested Windows) you can make your regular
	mouse cursor show again here, while hiding your custom cursor.
	----------------------------------------------------------*/</span>
	yourCustomCursor.<span style="color: #0066CC;">visible</span>=<span style="color: #000000; font-weight: bold;">false</span>;
	<span style="color: #0066CC;">Mouse</span>.<span style="color: #0066CC;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> __onMouseInWorkSpace<span style="color: #66cc66;">&#40;</span>evt:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">/*--------------------------------------------------------
	When your mouse rolls back in the main WindowedApplication
	(and out of other nested Windows) you can hide your regular
	mouse cursor, while showing your custom cursor again.
	----------------------------------------------------------*/</span>
	yourCustomCursor.<span style="color: #0066CC;">visible</span>=<span style="color: #000000; font-weight: bold;">true</span>;
	<span style="color: #0066CC;">Mouse</span>.<span style="color: #0066CC;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2009/04/30/letting-displayobjects-find-the-main-windowedapplication-in-air/&ztz=Letting DisplayObjects Find the Main WindowedApplication in AIR'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2009/04/30/letting-displayobjects-find-the-main-windowedapplication-in-air/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nice Knobs &#8230;for Flex</title>
		<link>http://keith-hair.net/blog/2008/07/25/nice-knobs/</link>
		<comments>http://keith-hair.net/blog/2008/07/25/nice-knobs/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 09:31:06 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Components]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[dial]]></category>
		<category><![CDATA[gauge]]></category>
		<category><![CDATA[knob]]></category>
		<category><![CDATA[rotary]]></category>

		<guid isPermaLink="false">http://keith-hair.com/blog/?p=20</guid>
		<description><![CDATA[Here is a Flex UI component I've been writing. Click the image to play with what I have made so far. You can change a variety of properties. The dial and mark are runtime skinnable by setting its "dialBackgroundSkin" or "dialMarkSkin" property to a url with an image.  Knobs and dials just look cool...I don't [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a <a href="/blog/examples/niceknobs" target="_blank">Flex UI component</a> I've been writing. Click the image to play with what I have made so far.<br />
You can change a variety of properties. The dial and mark are runtime skinnable by setting its "dialBackgroundSkin" or "dialMarkSkin" property to a url with an image. <strong></strong></p>
<p>Knobs and dials just look cool...I don't know anything about audio editing but I like the site of a sound studio. This is the "<a href="http://www.propellerheads.se/">Reason</a>" I decided to make a knob component.</p>
<p style="text-align: center;"><a href="http:/blog/examples/niceknobs" target="_blank"><img class="alignnone aligncenter" src="/blog/examples/niceknobs/niceknobs.jpg" alt="Nice Knobs" /></a></p>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2008/07/25/nice-knobs/&ztz=Nice Knobs ...for Flex'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2008/07/25/nice-knobs/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
