<?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>Phil Peron &#187; flex</title>
	<atom:link href="http://philperon.com/tag/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://philperon.com</link>
	<description>Flash Platform Developer and Game Development Hobbyist</description>
	<lastBuildDate>Wed, 23 Jun 2010 15:30:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Skinning Flex 4 Window Chrome in AIR for both Windows and Mac</title>
		<link>http://philperon.com/2009/09/17/skinning-flex-4-window-chrome-in-air/</link>
		<comments>http://philperon.com/2009/09/17/skinning-flex-4-window-chrome-in-air/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 00:47:30 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[air]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://philperon.com/?p=528</guid>
		<description><![CDATA[The beauty of writing AIR applications is how easy it is to skin the user interface in whatever way you choose. It allows you to spend more time refining that interface instead of worrying about getting it to work. So in the spirit of refinement, let&#8217;s take a look at how simple it is to [...]]]></description>
			<content:encoded><![CDATA[<p>The beauty of writing AIR applications is how easy it is to skin the user interface in whatever way you choose. It allows you to spend more time refining that interface instead of worrying about getting it to work. So in the spirit of refinement, let&#8217;s take a look at how simple it is to skin an AIR application&#8217;s window chrome (or TitleBar) to suit the expectations of users on both Windows and Mac.<br />
<span id="more-528"></span></p>
<p>First, create a new ActionScript class that extends spark.components.windowClasses.TitleBar:</p>
<pre>
<code>
package com.philperon.components
{
    import spark.components.windowClasses.TitleBar;

    public class TitleBar extends spark.components.windowClasses.TitleBar
    {
        public function TitleBar()
        {
	    super();
	}
    }
}

 </code>
</pre>
<p>Now, you&#8217;ll want to create two skin classes for your TitleBar. One for Mac and one for Windows. To get you started, simply copy TitleBarSkin.mxml and MacTitleBarSkin.mxml from:</p>
<pre>
<code>
YOUR_FLEX_DIR/frameworks/projects/airframework/src/spark/skins/default/

 </code>
</pre>
<p>&#8230;and paste them into your skins directory. Once that&#8217;s done, import them into your TitleBar class and override the attachSkin method:</p>
<pre>
<code>
package com.philperon.components
{
    import com.philperon.skins.MacWindowTitleBarSkin;
    import com.philperon.skins.WinWindowTitleBarSkin;

    import spark.components.windowClasses.TitleBar;

    public class TitleBar extends spark.components.windowClasses.TitleBar
    {
        public function TitleBar()
        {
	    super();
	}

	override protected function attachSkin():void
        {
	    if (isMac() &amp;&amp; getStyle("skinClass") == WinWindowTitleBarSkin)
	    {
	        setStyle("skinClass", MacWindowTitleBarSkin);
	    } 

	    super.attachSkin();
	}
    }
}

 </code>
</pre>
<p>Notice the &#8216;isMac&#8217; method. This is a private method defined in the original TitleBar class that we can copy over as well.</p>
<pre>
<code>
package com.philperon.components
{
    import com.philperon.skins.MacWindowTitleBarSkin;
    import com.philperon.skins.WinWindowTitleBarSkin;

    import flash.system.Capabilities;

    import spark.components.windowClasses.TitleBar;

    public class TitleBar extends spark.components.windowClasses.TitleBar
    {
	public function TitleBar()
	{
	    super();
	}

	override protected function attachSkin():void
	{
	    if (isMac() &amp;&amp; getStyle("skinClass") == WinWindowTitleBarSkin)
	    {
	        setStyle("skinClass", MacWindowTitleBarSkin);
	    } 

	    super.attachSkin();
        }

	private static function isMac():Boolean
    	{
            return Capabilities.os.substring(0, 3) == "Mac";
    	}
    }
}

 </code>
</pre>
<p>Now it&#8217;s just a matter of tweaking your new TitleBar skins to match the look and feel you&#8217;re trying to express.</p>
<p>To tie it all together, don&#8217;t forget to point the component to your new skin. I follow what the Flex team does and default to the Windows style.</p>
<pre>
<code>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/halo";
@namespace p "com.philperon.components.*";

p|TitleBar
{
    skinClass: ClassReference("com.philperon.skins.WinWindowTitleBarSkin")
}

 </code>
</pre>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://philperon.com/2009/09/17/skinning-flex-4-window-chrome-in-air/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>TODO/FIXME Extension for Flex IDE</title>
		<link>http://philperon.com/2008/07/01/todofixme-extension-for-flex-ide/</link>
		<comments>http://philperon.com/2008/07/01/todofixme-extension-for-flex-ide/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 21:39:16 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://philperon.com/?p=17</guid>
		<description><![CDATA[Two years ago, Sven Ramuschkat and Dirk Eismann announced an extremely useful Flex plug-in on their site, richinternet.blog. Guess who&#8217;s late to the party?
The Flex Task Plugin parses .mxml and .as files looks for instances of &#8220;TODO&#8221; or &#8220;FIXME&#8221; and adds the comments that follow to your Tasks view.
How freaking cool is that? Simple. Perfect. [...]]]></description>
			<content:encoded><![CDATA[<p>Two years ago, Sven Ramuschkat and Dirk Eismann announced an extremely useful Flex plug-in on their site, <a href="http://www.richinternet.de/blog/index.cfm" title="richinternet.blog">richinternet.blog</a>. <em>Guess who&#8217;s late to the party?</em></p>
<p><a href="http://www.richinternet.de/blog/index.cfm?entry=911D4B57-0F0D-5A73-AF6F4D4D04099757" title="Flex Task Plugin">The Flex Task Plugin</a> parses .mxml and .as files looks for instances of &#8220;TODO&#8221; or &#8220;FIXME&#8221; and adds the comments that follow to your Tasks view.</p>
<p>How freaking cool is that? Simple. Perfect. Love it.</p>
]]></content:encoded>
			<wfw:commentRss>http://philperon.com/2008/07/01/todofixme-extension-for-flex-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Components: MXML vs. ActionScript</title>
		<link>http://philperon.com/2008/06/16/flex-components-mxml-vs-actionscript/</link>
		<comments>http://philperon.com/2008/06/16/flex-components-mxml-vs-actionscript/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 21:38:48 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://philperon.com/?p=16</guid>
		<description><![CDATA[One question that has constantly nagged me during my conversion from Flash to Flex development is, &#8220;Do I write this thingamajig in MXML or ActionScript?&#8221; The question is usually answered by the type of component that&#8217;s being written. If it&#8217;s a visual component, I&#8217;ll write MXML otherwise, I&#8217;ll write the whole thing in ActionScript.
 This [...]]]></description>
			<content:encoded><![CDATA[<p>One question that has constantly nagged me during my conversion from Flash to Flex development is, &#8220;Do I write this thingamajig in MXML or ActionScript?&#8221; The question is usually answered by the type of component that&#8217;s being written. If it&#8217;s a visual component, I&#8217;ll write MXML otherwise, I&#8217;ll write the whole thing in ActionScript.</p>
<p><span id="more-16"></span> This kind of reasoning was satisfying in the beginning but as I gain more experience with component development in Flex, I&#8217;m finding that it may not be as clear cut as I once thought. In fact, it wasn&#8217;t until I glanced at <a href="http://www.adobe.com/devnet/flex/quickstart/building_components_using_code_behind/" title="Building components by using code behind">this article </a>on Adobe&#8217;s <a href="http://www.adobe.com/devnet/" title="Adobe Developer Connection">Developer Connection site</a> that I&#8217;ve since refined my decision-making process.</p>
<p>Here are the two points mentioned in the article:</p>
<ul>
<li>When you create composite controls declaratively, MXML makes it easier to create and lay out child controls.</li>
<li>When you modify the behavior of components, that is, override their methods, you typically use ActionScript.</li>
</ul>
<p>As simple and obvious as they may sound, they&#8217;re quite powerful when trying to decide in which direction to take your development. As stated in the article, most of the time you&#8217;ll be using a combination of the two. One way to do that is by using a technique called &#8220;code behind&#8221; which is something I&#8217;m working on right now&#8230;</p>
<p>UPDATE: After playing with the code behind technique mentioned in the article it seems obvious to me that it&#8217;s the way to go in most cases. It&#8217;s also very satisfying to separate form from function in a sensible manner.  Unless, you&#8217;re developing a very simple component you should probably get in the habit of writing core logic (as a class) in ActionScript and extending it via the root tag in MXML.</p>
]]></content:encoded>
			<wfw:commentRss>http://philperon.com/2008/06/16/flex-components-mxml-vs-actionscript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
