<?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; air</title>
	<atom:link href="http://philperon.com/tag/air/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>AIR Locks flashlog.txt</title>
		<link>http://philperon.com/2008/04/28/air-locks-flashlogtxt/</link>
		<comments>http://philperon.com/2008/04/28/air-locks-flashlogtxt/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 15:07:55 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://philperon.com/?p=15</guid>
		<description><![CDATA[Airlocks are cool. They save lives every day.
AIR locks suck. They make life hell when you&#8217;re debugging.
I&#8217;ve just found the hard way that an application running on AIR puts an exclusive lock on your flashlog.txt file. So if you&#8217;re a fan of FlashTracer to keep track of your trace statements and of installing and using [...]]]></description>
			<content:encoded><![CDATA[<p>Airlocks are cool. They save lives every day.</p>
<p>AIR locks suck. They make life hell when you&#8217;re debugging.</p>
<p>I&#8217;ve just found the hard way that an application running on AIR puts an exclusive lock on your flashlog.txt file. So if you&#8217;re a fan of <a href="https://addons.mozilla.org/en-US/firefox/addon/3469">FlashTracer</a> to keep track of your trace statements and of installing and using AIR apps, you&#8217;re SOL.</p>
<p>In short, you can either develop AIR apps or use them, but not both.</p>
<p>You can check out the useless bug page, <a href="http://bugs.adobe.com/jira/browse/SDK-14536">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://philperon.com/2008/04/28/air-locks-flashlogtxt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
