<?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>Flex notes</title>
	<atom:link href="http://www.robertbak.com/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.robertbak.com/wordpress</link>
	<description>My notes on Flex related topics</description>
	<lastBuildDate>Tue, 20 Apr 2010 20:04:57 +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>Dark themes for Flash Builder</title>
		<link>http://www.robertbak.com/wordpress/2010/04/dark-themes-for-flash-builder/</link>
		<comments>http://www.robertbak.com/wordpress/2010/04/dark-themes-for-flash-builder/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 12:19:08 +0000</pubDate>
		<dc:creator>Robert Bak</dc:creator>
				<category><![CDATA[Builder]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[flash builder]]></category>
		<category><![CDATA[scheme]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.robertbak.com/wordpress/?p=195</guid>
		<description><![CDATA[Spending a lot of time in front of a bright LCD monitor can be a real pain for the eyes. But there’s no good reason why you should keep the default white background behind your code. After a search I found that some people have already prepared configurations that will allow you to have bright [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Spending a lot of time in front of a bright LCD monitor can be a real pain for the eyes. But there’s no good reason why you should keep the default white background behind your code. After a search I found that some people have already prepared configurations that will allow you to have bright text on a dark background.</p>
<h3>Quick list of themes</h3>
<p><strong>fb-zenburnish</strong> &#8211; <a href="http://www.noiseandheat.com/blog/2010/01/25/fb-zenburnish-a-zenburn-inspired-colour-scheme-for-flashbuilder-4/">http://www.noiseandheat.com/blog/</a><br />
<strong>Dark theme for Flash Builder 4</strong> &#8211; <a href="http://www.likidu.com/blog/2009/08/dark-theme-for-flash-builder-4-beta/">http://www.likidu.com/blog/</a><br />
<strong>The Typography of My Flash Builder </strong> &#8211; <a href="http://kevinsuttle.com/2009/10/28/the-typography-of-my-flash-builder/">http://kevinsuttle.com/</a></p>
<p>After testing them for a while I&#8217;m currently using fb-zenburnish.</p>
<h3>Installing a theme</h3>
<p>First download the file, and unzip if necessary. You should have an .epf file. Now go to the Flash Builder, and from the File menu select Import->Other. <em>(you might want to backup your current settings before importing the new ones, just choose Export instead of Import and it should be a straight forward process)</em><br />
<a href="http://www.robertbak.com/wordpress/wp-content/uploads/2010/04/Other.png"><img src="http://www.robertbak.com/wordpress/wp-content/uploads/2010/04/Other.png" alt="Import -&gt; Other" title="Import -&gt; Other" width="512" height="140" class="aligncenter size-full wp-image-203" /></a><br />
Than choose <em>Preferences</em> from the <em>General</em> node and click Next.<br />
<a href="http://www.robertbak.com/wordpress/wp-content/uploads/2010/04/Preferences.png"><img src="http://www.robertbak.com/wordpress/wp-content/uploads/2010/04/Preferences.png" alt="Preferences" title="Preferences" width="330" height="154" class="aligncenter size-full wp-image-201" /></a><br />
Than just browse for the epf file and click Finish.<br />
<a href="http://www.robertbak.com/wordpress/wp-content/uploads/2010/04/file.png"><img src="http://www.robertbak.com/wordpress/wp-content/uploads/2010/04/file.png" alt="" title="Browse " width="434" height="49" class="aligncenter size-full wp-image-202" /></a><br />
Your brand new color scheme should be set. </p>
<p><a href="http://www.robertbak.com/wordpress/wp-content/uploads/2010/04/code.png"><img src="http://www.robertbak.com/wordpress/wp-content/uploads/2010/04/code.png" alt="" title="Code" width="545" height="303" class="aligncenter size-full wp-image-207" /></a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Dark+themes+for+Flash+Builder+-+http://b2l.me/qg7s2+&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://www.robertbak.com/wordpress/2010/04/dark-themes-for-flash-builder/feed" rel="nofollow" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.robertbak.com/wordpress/2010/04/dark-themes-for-flash-builder/&amp;imageurl=" rel="nofollow" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.robertbak.com/wordpress/2010/04/dark-themes-for-flash-builder/&amp;t=Dark+themes+for+Flash+Builder" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.robertbak.com/wordpress/2010/04/dark-themes-for-flash-builder/&amp;title=Dark+themes+for+Flash+Builder&amp;summary=Spending%20a%20lot%20of%20time%20in%20front%20of%20a%20bright%20LCD%20monitor%20can%20be%20a%20real%20pain%20for%20the%20eyes.%20But%20there%E2%80%99s%20no%20good%20reason%20why%20you%20should%20keep%20the%20default%20white%20background%20behind%20your%20code.%20After%20a%20search%20I%20found%20that%20some%20people%20have%20already%20prepared%20configurations%20that%20will%20allow%20you%20to%20have%20bright%20tex&amp;source=Flex notes" rel="nofollow" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="sexy-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.robertbak.com/wordpress/2010/04/dark-themes-for-flash-builder/&amp;n=Dark+themes+for+Flash+Builder&amp;pli=1" rel="nofollow" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.robertbak.com/wordpress/2010/04/dark-themes-for-flash-builder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>From photoshop design to a Flex 4 skin</title>
		<link>http://www.robertbak.com/wordpress/2010/03/from-photoshop-design-to-a-flex-4-skin/</link>
		<comments>http://www.robertbak.com/wordpress/2010/03/from-photoshop-design-to-a-flex-4-skin/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 18:03:36 +0000</pubDate>
		<dc:creator>Robert Bak</dc:creator>
				<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[skins flex4]]></category>

		<guid isPermaLink="false">http://www.robertbak.com/wordpress/?p=133</guid>
		<description><![CDATA[When looking at some old project folders I&#8217;ve found one of the first skins I&#8217;ve created while starting with the Flex 4 skinning model, and I thought it might be an interesting case to look at, source code is included at the end of the post. It&#8217;s based on a really nice design done by [...]]]></description>
			<content:encoded><![CDATA[<p>When looking at some old project folders I&#8217;ve found one of the first skins I&#8217;ve created while starting with the Flex 4 skinning model, and I thought it might be an interesting case to look at, source code is included at the end of the post. It&#8217;s based on a really nice design done by <a href="http://www.adrianpelletier.com/">Adrian Pelletier</a>. What we&#8217;ll try to do is create a button which looks more or less like one of his button designs:<br />
<a href="http://www.robertbak.com/wordpress/wp-content/uploads/2010/03/button-design.png"><img class="aligncenter size-full wp-image-129" title="button-design" src="http://www.robertbak.com/wordpress/wp-content/uploads/2010/03/button-design.png" alt="" width="524" height="94" /></a><br />
What makes it a good design is not only the way it looks but also the way the Photoshop file is created &#8211; it&#8217;s mostly based on shapes and layer effects which are easy to translate to Flex skin code.<br />
<a href="http://www.robertbak.com/wordpress/wp-content/uploads/2010/03/layers.png"><img class="aligncenter size-full wp-image-131" title="layers" src="http://www.robertbak.com/wordpress/wp-content/uploads/2010/03/layers.png" alt="" width="219" height="115" /></a></p>
<h3>Styling a Flex 4 Button</h3>
<p>The Flex 4 skinning model is different from the one used in Flex 3, to keep the introduction short, let&#8217;s just say it&#8217;s now much easier to create programmatic skins, and you can do it with newly introduced MXML tags. If you ever used Degrafa to skin your components it&#8217;s should be fairly familiar, if not please check the example code. The basic usage is straight forward &#8211; you need to create a <em>mxml</em> file and you can start putting the new tags to design the skin.</p>
<p>Let&#8217;s start with the shadow behind the button, as you can see on the picture above it has 3 parts &#8211; a gradient fill, a stroke and an inner shadow, and all of them thrown on a shape of a rounded rectangle. Let&#8217;s translate this to graphic tags. First of we need that rounded rectangle, so we define a Rectangle with the corner radius using the new tags:</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&lt;</span>s:Rect radiusY=<span style="color: #ff0000;">&quot;24&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; radiusX=<span style="color: #ff0000;">&quot;24&quot;</span><span style="color: #66cc66;">/&gt;</span></div></div>
<p>That&#8217;s how easy it is to create shapes using the new syntax. Next we need to define a fill, which according to the Photoshop design is a linear gradient starting from color 0x0f2835 and ending with color 0&#215;153445. We also need an inner drop shadow on it, so let&#8217;s add it. We also need a stroke <strong>above</strong> all this, so we need to add another rectangle which will not have the drop shadow on it, and will define that gradient stroke, just like the design. A few minutes later we have:</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&lt;</span>s:Rect radiusY=<span style="color: #ff0000;">&quot;24&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; radiusX=<span style="color: #ff0000;">&quot;24&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x=<span style="color: #ff0000;">&quot;0&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y=<span style="color: #ff0000;">&quot;0&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;{this.width}&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;{this.height}&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:filters<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:DropShadowFilter inner=<span style="color: #ff0000;">&quot;true&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; distance=<span style="color: #ff0000;">&quot;0&quot;</span> &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strength=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:filters<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:fill<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:LinearGradient rotation=<span style="color: #ff0000;">&quot;90&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:GradientEntry <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;0x0f2835&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:GradientEntry <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;0x153445&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:LinearGradient<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:fill<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:Rect<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:Rect radiusY=<span style="color: #ff0000;">&quot;24&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; radiusX=<span style="color: #ff0000;">&quot;24&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x=<span style="color: #ff0000;">&quot;0&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y=<span style="color: #ff0000;">&quot;0&quot;</span> &nbsp;alpha=<span style="color: #ff0000;">&quot;0.8&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;{this.width}&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;{this.height}&quot;</span> <span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:stroke<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:LinearGradientStroke rotation=<span style="color: #ff0000;">&quot;90&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;weight=<span style="color: #ff0000;">&quot;2&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pixelHinting=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:GradientEntry <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;0x102a39&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:GradientEntry <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;0x20516c&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>mx:LinearGradientStroke<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:stroke<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:Rect<span style="color: #66cc66;">&gt;</span></div></div>
<p>It&#8217;s not the shortest listing, but remember that I&#8217;m only copying the settings from the design. The final flash result looks like this:<br />
<a href="http://www.robertbak.com/wordpress/wp-content/uploads/2010/03/shadow.png"><img class="aligncenter size-full wp-image-148" title="shadow" src="http://www.robertbak.com/wordpress/wp-content/uploads/2010/03/shadow.png" alt="" width="184" height="76" /></a></p>
<p>It&#8217;s almost a easy to create the rest of the design, take a look a the working button with some Flex magic thrown in to get nice transitions between states (<a href="http://robertbak.com/flexsamples/buttonSkin/source/index.html">viewsource</a> enabled), and after the jump, I&#8217;ll quickly point to different parts of the design which are used in the <i>ButtonSkin.mxml</i></p>
<h3>Result</h3>
<p> <iframe class="aligncenter size-full" src="http://robertbak.com/flexsamples/buttonSkin/SampleSkinApplication.html" style="height: 201px; width: 301px;" frameborder="0">Please upgrade your browser</iframe></p>
<h3>What makes a skin &#8211; looking at ButtonSkin.mxml</h3>
<p>First of you should define a component for which the skin is designed.</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;<span style="color: #66cc66;">&#91;</span>HostComponent<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;spark.components.Button&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></div></div>
<p>Next you need to define all the states which are defined by the host component (you can check this info on <a href="http://help.adobe.com/en_US/Flex/4.0/langref/spark/components/Button.html#SkinStateSummary">livedocs</a>) which is done in this code:</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>s:states<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;up&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;down&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;over&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:State <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;disabled&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>s:states<span style="color: #66cc66;">&gt;</span></div></div>
<p>After that&#8217;s done you also need to put the parts of the skin that the host components assumes your skin will have (this is called <i>skinning contract</i> and I&#8217;ll write a post about it when I have some time). In the case of Button we need to display a single string (the button label as stated in <a href="http://help.adobe.com/en_US/Flex/4.0/langref/spark/components/Button.html#SkinPartSummary">livedocs</a>) we&#8217;re going to use a <i>Label</i> for that and give it an id of <i>labelDisplay</i> according to the contract.</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&lt;</span>s:Label <span style="color: #0066CC;">left</span>=<span style="color: #ff0000;">&quot;17&quot;</span> <span style="color: #0066CC;">right</span>=<span style="color: #ff0000;">&quot;17&quot;</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;0xffffff&quot;</span> <br />
&nbsp; &nbsp; <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;{this.height}&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span> id=<span style="color: #ff0000;">&quot;labelDisplay&quot;</span> <span style="color: #66cc66;">&gt;</span></div></div>
<p>Than we can start putting in the graphics, using the same tags we used while creating the shadow. The only additions is that the values of the gradients change depending on the state, thanks to the new state syntax in Flex 4 it&#8217;s much more readable &#8211; there&#8217;s a different color when the button is in an over state (<i>color.over</i>) and a different one when the button is in the down state (<i>color.down</i>)</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&lt;</span>mx:GradientEntry id=<span style="color: #ff0000;">&quot;ge1&quot;</span> <span style="color: #0066CC;">color</span>=<span style="color: #ff0000;">&quot;0x387dda&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">color</span>.<span style="color: #006600;">over</span>=<span style="color: #ff0000;">&quot;0x3e81de&quot;</span> <span style="color: #0066CC;">color</span>.<span style="color: #0066CC;">down</span>=<span style="color: #ff0000;">&quot;0x88bafe&quot;</span> <span style="color: #66cc66;">/&gt;</span></div></div>
<p>To add the smooth color fades between states we also define a bunch of transitions which work on our gradient entries.</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&lt;</span>s:Transition &nbsp; fromState=<span style="color: #ff0000;">&quot;up&quot;</span> toState=<span style="color: #ff0000;">&quot;over&quot;</span> autoReverse=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp;<span style="color: #66cc66;">&lt;</span>s:AnimateColor targets=<span style="color: #ff0000;">&quot;{[ge1, ge2, ge3, ge4]}&quot;</span> &nbsp;<span style="color: #0066CC;">duration</span>=<span style="color: #ff0000;">&quot;250&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp;<span style="color: #66cc66;">&lt;/</span>s:Transition<span style="color: #66cc66;">&gt;</span></div></div>
<p>Feel free to download the source code and play with it, hopefully it will be a good starting point.<br />
<a href="http://robertbak.com/flexsamples/buttonSkin/source/SampleSkin.zip"><br />
Download source code.</a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=From+photoshop+design+to+a+Flex+4+skin+-+http://b2l.me/qhb52+&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://www.robertbak.com/wordpress/2010/03/from-photoshop-design-to-a-flex-4-skin/feed" rel="nofollow" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.robertbak.com/wordpress/2010/03/from-photoshop-design-to-a-flex-4-skin/&amp;imageurl=" rel="nofollow" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.robertbak.com/wordpress/2010/03/from-photoshop-design-to-a-flex-4-skin/&amp;t=From+photoshop+design+to+a+Flex+4+skin" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.robertbak.com/wordpress/2010/03/from-photoshop-design-to-a-flex-4-skin/&amp;title=From+photoshop+design+to+a+Flex+4+skin&amp;summary=When%20looking%20at%20some%20old%20project%20folders%20I%27ve%20found%20one%20of%20the%20first%20skins%20I%27ve%20created%20while%20starting%20with%20the%20Flex%204%20skinning%20model%2C%20and%20I%20thought%20it%20might%20be%20an%20interesting%20case%20to%20look%20at%2C%20source%20code%20is%20included%20at%20the%20end%20of%20the%20post.%20It%27s%20based%20on%20a%20really%20nice%20design%20done%20by%20Adrian%20Pelletier&amp;source=Flex notes" rel="nofollow" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="sexy-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.robertbak.com/wordpress/2010/03/from-photoshop-design-to-a-flex-4-skin/&amp;n=From+photoshop+design+to+a+Flex+4+skin&amp;pli=1" rel="nofollow" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.robertbak.com/wordpress/2010/03/from-photoshop-design-to-a-flex-4-skin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How not to use &#8220;services_config.xml&#8221;</title>
		<link>http://www.robertbak.com/wordpress/2010/02/how-not-to-use-services_config-xml/</link>
		<comments>http://www.robertbak.com/wordpress/2010/02/how-not-to-use-services_config-xml/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 07:43:12 +0000</pubDate>
		<dc:creator>Robert Bak</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[RemoteObject]]></category>
		<category><![CDATA[services]]></category>
		<category><![CDATA[services_config]]></category>

		<guid isPermaLink="false">http://www.robertbak.com/wordpress/?p=102</guid>
		<description><![CDATA[The most common way to use RemoteServices in flex is by creating a separate file to keep the configuration, and adding the &#8220;-services&#8221; switch to the compiler arguments. It&#8217;s a good way to do it, but not always, and is especially painful when explaining remoting to someone. But you can skip the whole file and [...]]]></description>
			<content:encoded><![CDATA[<p>The most common way to use RemoteServices in flex is by creating a separate file to keep the configuration, and adding  the  &#8220;-services&#8221; switch to the compiler arguments. It&#8217;s a good way to do it, but not always, and is especially painful when explaining remoting to someone. But you can skip the whole file and configure the same thing using MXML tags. I&#8217;ll take a sample &#8220;services_config&#8221; file (this one is for zend_amf) and translate it to MXML.</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;UTF-8&quot;</span>?<span style="color: #66cc66;">&gt;</span><br />
<span style="color: #66cc66;">&lt;</span>services-config<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>services<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>service id=<span style="color: #ff0000;">&quot;amfphp-flashremoting-service&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">class</span>=<span style="color: #ff0000;">&quot;flex.messaging.services.RemotingService&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; messageTypes=<span style="color: #ff0000;">&quot;flex.messaging.messages.RemotingMessage&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>destination id=<span style="color: #ff0000;">&quot;zend&quot;</span><span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>channels<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>channel ref=<span style="color: #ff0000;">&quot;library&quot;</span><span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>channels<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>properties<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>source<span style="color: #66cc66;">&gt;*&lt;/</span>source<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>properties<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>destination<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>service<span style="color: #66cc66;">&gt;</span> &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>services<span style="color: #66cc66;">&gt;</span> &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>channels<span style="color: #66cc66;">&gt;</span> &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&lt;</span>channel-definition id=<span style="color: #ff0000;">&quot;library&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">class</span>=<span style="color: #ff0000;">&quot;mx.messaging.channels.AMFChannel&quot;</span> <span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&lt;</span>endpoint uri=<span style="color: #ff0000;">&quot;http://localhost/librarySample/amf.php&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">class</span>=<span style="color: #ff0000;">&quot;flex.messaging.endpoints.AMFEndpoint&quot;</span> <span style="color: #66cc66;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>channel-definition<span style="color: #66cc66;">&gt;</span> &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&lt;/</span>channels<span style="color: #66cc66;">&gt;</span> <br />
<span style="color: #66cc66;">&lt;/</span>services-config<span style="color: #66cc66;">&gt;</span></div></div>
<p>translates to:</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&lt;</span>mx:ChannelSet id=<span style="color: #ff0000;">&quot;chanelSet&quot;</span> <span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:AMFChannel <br />
&nbsp; &nbsp; &nbsp; uri=<span style="color: #ff0000;">&quot;http://localhost/librarySample/sampleamf.php&quot;</span> <span style="color: #66cc66;">/&gt;</span><br />
<span style="color: #66cc66;">&lt;/</span>mx:ChannelSet<span style="color: #66cc66;">&gt;</span><br />
<br />
<span style="color: #66cc66;">&lt;</span>mx:RemoteObject &nbsp; <br />
&nbsp; &nbsp; &nbsp; channelSet=<span style="color: #ff0000;">&quot;{chanelSet}&quot;</span> <span style="color: #66cc66;">&gt;</span>&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;<span style="color: #66cc66;">&lt;/</span>mx:RemoteObject<span style="color: #66cc66;">&gt;</span></div></div>
<p>So what you need to do is create a ChannelSet, put a channel inside (in this case AMFChannel) and set its uri to the one you would usually put as endpoint uri in the config file.<br />
Once you do that you can start using your RemoteObjects without the services_config. </p>
<p>Of course you should add the rest of the things you usually put inside a remote object. For people who would like an example:</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&lt;</span>mx:RemoteObject &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; channelSet=<span style="color: #ff0000;">&quot;{chanelSet}&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; source=<span style="color: #ff0000;">&quot;myServerSideClassName&quot;</span> &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; destination=<span style="color: #ff0000;">&quot;zend&quot;</span> <span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;</span>mx:method <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">name</span>=<span style="color: #ff0000;">&quot;serverSideFunctionName&quot;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result=<span style="color: #ff0000;">&quot;someResultFunction()&quot;</span> <span style="color: #66cc66;">/&gt;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<span style="color: #66cc66;">&lt;/</span>mx:RemoteObject<span style="color: #66cc66;">&gt;</span></div></div>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=How+not+to+use+%22services_config.xml%22+-+http://b2l.me/qhe5u+&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://www.robertbak.com/wordpress/2010/02/how-not-to-use-services_config-xml/feed" rel="nofollow" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.robertbak.com/wordpress/2010/02/how-not-to-use-services_config-xml/&amp;imageurl=" rel="nofollow" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.robertbak.com/wordpress/2010/02/how-not-to-use-services_config-xml/&amp;t=How+not+to+use+%22services_config.xml%22" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.robertbak.com/wordpress/2010/02/how-not-to-use-services_config-xml/&amp;title=How+not+to+use+%22services_config.xml%22&amp;summary=The%20most%20common%20way%20to%20use%20RemoteServices%20in%20flex%20is%20by%20creating%20a%20separate%20file%20to%20keep%20the%20configuration%2C%20and%20adding%20%20the%20%20%22-services%22%20switch%20to%20the%20compiler%20arguments.%20It%27s%20a%20good%20way%20to%20do%20it%2C%20but%20not%20always%2C%20and%20is%20especially%20painful%20when%20explaining%20remoting%20to%20someone.%20But%20you%20can%20skip%20the%20who&amp;source=Flex notes" rel="nofollow" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="sexy-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.robertbak.com/wordpress/2010/02/how-not-to-use-services_config-xml/&amp;n=How+not+to+use+%22services_config.xml%22&amp;pli=1" rel="nofollow" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.robertbak.com/wordpress/2010/02/how-not-to-use-services_config-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things you might not know about calling actionscript functions</title>
		<link>http://www.robertbak.com/wordpress/2010/02/things-you-might-not-know-about-calling-actionscript-functions/</link>
		<comments>http://www.robertbak.com/wordpress/2010/02/things-you-might-not-know-about-calling-actionscript-functions/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 22:20:21 +0000</pubDate>
		<dc:creator>Robert Bak</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Function]]></category>

		<guid isPermaLink="false">http://www.robertbak.com/wordpress/?p=38</guid>
		<description><![CDATA[OK, my guess would be that everybody used a function at one point or another. But there are some things which are less than obvious about an actionscript function. Let&#8217;s take a quick look. Calling functions Let&#8217;s create a simple function which will accept any number of parameters. function sum&#40;...arg&#41;:int &#123; &#160; &#160; &#160; var [...]]]></description>
			<content:encoded><![CDATA[<p>OK, my guess would be that everybody used a function at one point or another. But there are some things which are less than obvious about an actionscript function. Let&#8217;s take a quick look.</p>
<h3>Calling functions</h3>
<p>Let&#8217;s create a simple function which will accept any number of parameters.</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> sum<span style="color: #66cc66;">&#40;</span>...<span style="color: #006600;">arg</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">int</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> val:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> <span style="color: #b1b100;">in</span> arg<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; val+=i;<br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> val;<br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #808080; font-style: italic;">// The usual way to call it</span><br />
sum<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>;</div></div>
<p>But that&#8217;s something everybody knew how to do. The interesting thing is that in Actionscript 3.0 there is a class called <em>Function</em> which also has it&#8217;s own methods defined, and all the functions are instances of that class. Most of the methods are inherited from <em>Object</em> but there are two defined for it, which are used to achieve a similar thing &#8211; calling the function, this are <strong>apply()</strong> and <strong>call()</strong>. The first parameter of both functions is almost always ignored [1]. </p>
<p>The definition of call &#8211; <code class="codecolorer actionscript default"><span class="actionscript"><span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span>thisArg:<span style="color: #66cc66;">*</span>, ...<span style="color: #006600;">args</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #66cc66;">*</span></span></code> shows that it also takes any number of parameters, than it uses them as arguments, so, as the first parameter is ignored &#8211; <code class="codecolorer actionscript default"><span class="actionscript">sum.<span style="color: #0066CC;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">null</span>,<span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span></span></code> is the same as <code class="codecolorer actionscript default"><span class="actionscript">sum<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span></span></code>.<br />
The problem with calling functions like this is that you actually need to know how many parameters you&#8217;re going to use. </p>
<p>Luckily <strong>apply()</strong> has an array as a second parameter. Which means you can call a function, and pass any number of parameters as an Array. Quick sample of achieving the exact same functionality as before using <em>apply</em>.</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">// this array can be dynamically generated</span><br />
<span style="color: #000000; font-weight: bold;">var</span> params:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span>;<br />
sum.<span style="color: #0066CC;">apply</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">null</span>,params<span style="color: #66cc66;">&#41;</span>;</div></div>
<p>Which is much more flexible.</p>
<h3>arguments variable</h3>
<p>One more thing which is worth knowing is that inside functions you can access the <code class="codecolorer text default"><span class="text">arguments</span></code> variable. It&#8217;s holds all the variables passed to the function, with the limitation that it doesn&#8217;t work when using the <code class="codecolorer actionscript default"><span class="actionscript">...<span style="color: #006600;">arg</span></span></code> notation in the function definition. So this will not work:</p>
<pre>function sum(...arg):int
{
      trace (arguments);
      // throws an error
      [...]
}</pre>
<p>But it will work with functions without the <code class="codecolorer actionscript default"><span class="actionscript">...<span style="color: #006600;">arg</span></span></code> in the definition, for example this prints out both strings:</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> printStrings<span style="color: #66cc66;">&#40;</span>s:<span style="color: #0066CC;">String</span>,s2:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">arguments</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>Apart from that this variable also holds the reference to the currently executing function in the <code class="codecolorer actionscript default"><span class="actionscript"><span style="color: #0066CC;">arguments</span>.<span style="color: #0066CC;">callee</span></span></code> property. Things like this come in handy sometimes.</p>
<h3>Sample</h3>
<p>Using all the tools described (<em>callee, arguments, apply</em>) we can build a quick sample, a class that records the calls to it&#8217;s functions in an easy way, and is able to replay them when needed.</p>
<p><em>CallRecorder.as</em></p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">package<br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">collections</span>.<span style="color: #006600;">ArrayCollection</span>;<br />
&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CallRecorder<br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Just a sample function</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> printJohn<span style="color: #66cc66;">&#40;</span>s:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rememberTheCall<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">arguments</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'John says '</span> + s<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Just a another sample function</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// notice that it has a different set of arguments</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> printBob<span style="color: #66cc66;">&#40;</span>s:<span style="color: #0066CC;">String</span>,times:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rememberTheCall<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">arguments</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>times-- <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Bob says '</span> + s<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/** Replays all the calls in memory **/</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> replay<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; replayIsOn = <span style="color: #000000; font-weight: bold;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;--- Starting the replay ---&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Notice we actually don't need to worry </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// about the arguments &nbsp;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> arg:<span style="color: #0066CC;">Object</span> <span style="color: #b1b100;">in</span> memory<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span>arg.<span style="color: #0066CC;">callee</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">apply</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>,arg<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; replayIsOn = <span style="color: #000000; font-weight: bold;">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">trace</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;--- Stoping the replay ---&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/** True if currently &nbsp;replaying **/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> replayIsOn:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/** Used for storing the history of function calls **/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> memory:ArrayCollection = <span style="color: #000000; font-weight: bold;">new</span> ArrayCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/** Stores a call in memory, if not called while replay **/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> rememberTheCall<span style="color: #66cc66;">&#40;</span>passedArguments:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">!</span>replayIsOn<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; memory.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span>passedArguments<span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span></div></div>
<p>Sample execution:</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">var</span> recorder:CallRecorder = <span style="color: #000000; font-weight: bold;">new</span> CallRecorder<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
recorder.<span style="color: #006600;">printBob</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;I do&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
recorder.<span style="color: #006600;">printJohn</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;I do too&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
recorder.<span style="color: #006600;">printBob</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;:)&quot;</span>,<span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>;<br />
recorder.<span style="color: #006600;">printJohn</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;:)&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
recorder.<span style="color: #006600;">replay</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #808080; font-style: italic;">// results in</span><br />
<span style="color: #808080; font-style: italic;">// Bob says I do</span><br />
<span style="color: #808080; font-style: italic;">// John says I do too</span><br />
<span style="color: #808080; font-style: italic;">// Bob says :)</span><br />
<span style="color: #808080; font-style: italic;">// Bob says :)</span><br />
<span style="color: #808080; font-style: italic;">// Bob says :)</span><br />
<span style="color: #808080; font-style: italic;">// John says :)</span><br />
<span style="color: #808080; font-style: italic;">// --- Starting the replay ---</span><br />
<span style="color: #808080; font-style: italic;">// Bob says I do</span><br />
<span style="color: #808080; font-style: italic;">// John says I do too</span><br />
<span style="color: #808080; font-style: italic;">// Bob says :)</span><br />
<span style="color: #808080; font-style: italic;">// Bob says :)</span><br />
<span style="color: #808080; font-style: italic;">// Bob says :)</span><br />
<span style="color: #808080; font-style: italic;">// John says :)</span><br />
<span style="color: #808080; font-style: italic;">// --- Stoping the replay ---</span></div></div>
<p>Not a great piece of software but hopefully interesting.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
[1] The only case it&#8217;s not ignored which I could find is when using anonymous functions.<br />
<a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/Function.html">LiveDocs on Function class</a><br />
<a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/arguments.html">LiveDocs on arguments class</a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Things+you+might+not+know+about+calling+actionscript+functions+-+http://b2l.me/qhfe6+&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://www.robertbak.com/wordpress/2010/02/things-you-might-not-know-about-calling-actionscript-functions/feed" rel="nofollow" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.robertbak.com/wordpress/2010/02/things-you-might-not-know-about-calling-actionscript-functions/&amp;imageurl=" rel="nofollow" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.robertbak.com/wordpress/2010/02/things-you-might-not-know-about-calling-actionscript-functions/&amp;t=Things+you+might+not+know+about+calling+actionscript+functions" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.robertbak.com/wordpress/2010/02/things-you-might-not-know-about-calling-actionscript-functions/&amp;title=Things+you+might+not+know+about+calling+actionscript+functions&amp;summary=OK%2C%20my%20guess%20would%20be%20that%20everybody%20used%20a%20function%20at%20one%20point%20or%20another.%20But%20there%20are%20some%20things%20which%20are%20less%20than%20obvious%20about%20an%20actionscript%20function.%20Let%27s%20take%20a%20quick%20look.%0D%0A%0D%0ACalling%20functions%0D%0ALet%27s%20create%20a%20simple%20function%20which%20will%20accept%20any%20number%20of%20parameters.%0D%0A%0D%0Afunction%20su&amp;source=Flex notes" rel="nofollow" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="sexy-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.robertbak.com/wordpress/2010/02/things-you-might-not-know-about-calling-actionscript-functions/&amp;n=Things+you+might+not+know+about+calling+actionscript+functions&amp;pli=1" rel="nofollow" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.robertbak.com/wordpress/2010/02/things-you-might-not-know-about-calling-actionscript-functions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Spark Group, SkinPart and Error 1020</title>
		<link>http://www.robertbak.com/wordpress/2010/02/spark-group-skinpart-and-error-1020/</link>
		<comments>http://www.robertbak.com/wordpress/2010/02/spark-group-skinpart-and-error-1020/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 15:12:33 +0000</pubDate>
		<dc:creator>Robert Bak</dc:creator>
				<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[skinPart]]></category>
		<category><![CDATA[skins flex4 error]]></category>

		<guid isPermaLink="false">http://www.robertbak.com/wordpress/?p=21</guid>
		<description><![CDATA[I've added some SkinParts and it started throwing a strange error message on the definitions: 1020: Method marked override must override another method. ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently started a project that uses new Flex 4 skinning. It was going great until I&#8217;ve added some SkinParts and it started throwing a strange error message on those definitions :</p>
<blockquote><p>1020: Method marked override must override another method.</p></blockquote>
<p>After starring at it for a while with utter confusion, I&#8217;ve started to investigate what might be the problem. Turns out I was adding skin parts to a spark Group, and the documentation states:</p>
<blockquote><p>To improve performance and minimize application size,<br />
the Group container cannot be skinned.<br />
If you want to apply a skin, use the SkinnableContainer instead.</p></blockquote>
<p>Which is exactly what I needed to do. Too bad there was no hint about it in the error string.</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Spark+Group%2C+SkinPart+and+Error+1020+-+http://b2l.me/qhfe7+&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://www.robertbak.com/wordpress/2010/02/spark-group-skinpart-and-error-1020/feed" rel="nofollow" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.robertbak.com/wordpress/2010/02/spark-group-skinpart-and-error-1020/&amp;imageurl=" rel="nofollow" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.robertbak.com/wordpress/2010/02/spark-group-skinpart-and-error-1020/&amp;t=Spark+Group%2C+SkinPart+and+Error+1020" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.robertbak.com/wordpress/2010/02/spark-group-skinpart-and-error-1020/&amp;title=Spark+Group%2C+SkinPart+and+Error+1020&amp;summary=I%27ve%20recently%20started%20a%20project%20that%20uses%20new%20Flex%204%20skinning.%20It%20was%20going%20great%20until%20I%27ve%20added%20some%20SkinParts%20and%20it%20started%20throwing%20a%20strange%20error%20message%20on%20those%20definitions%20%3A%0D%0A1020%3A%20Method%20marked%20override%20must%20override%20another%20method.%0D%0AAfter%20starring%20at%20it%20for%20a%20while%20with%20utter%20confusion%2C&amp;source=Flex notes" rel="nofollow" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="sexy-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.robertbak.com/wordpress/2010/02/spark-group-skinpart-and-error-1020/&amp;n=Spark+Group%2C+SkinPart+and+Error+1020&amp;pli=1" rel="nofollow" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.robertbak.com/wordpress/2010/02/spark-group-skinpart-and-error-1020/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlexPMD released</title>
		<link>http://www.robertbak.com/wordpress/2009/09/flexpmd-released/</link>
		<comments>http://www.robertbak.com/wordpress/2009/09/flexpmd-released/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 15:01:29 +0000</pubDate>
		<dc:creator>Robert Bak</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.robertbak.com/wordpress/?p=16</guid>
		<description><![CDATA[There&#8217;s a new project on Adobe Open Source called FlexPMD (if You&#8217;re wondering what PMD stands for the answer is simple &#8211; nothing). It&#8217;s a tool that scans Actionsript and MXML code and points out bad practices, unused variables, etc. Really helpfull if you&#8217;re trying to keep the code clean and get a habit of  [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a new project on Adobe Open Source called <a href="http://opensource.adobe.com/wiki/display/flexpmd/FlexPMD" >FlexPMD</a> (if You&#8217;re wondering what PMD stands for the answer is simple &#8211; <a href="http://pmd.sourceforge.net/meaning.html" >nothing</a>). It&#8217;s a tool that scans Actionsript and MXML code and points out bad practices, unused variables, etc. Really helpfull if you&#8217;re trying to keep the code clean and get a habit of  coding really nicely.</p>
<p>To try it out you really just need to go to the <a href="http://opensource.adobe.com/wiki/display/flexpmd/Downloads">download page</a>, get one of the versions (I&#8217;ve tested the command line one on windows and it works very good), generete a ruleset file using the web tool (link on the same page), and that analize the output XML file (you can use the simple web tool which is also provided on the download page).</p>
<p>I&#8217;ve put both the jar files and the ruleset (called <em>pmd.xml</em>) in &#8220;F:/Flex SDK/Tools/FlexPMD/&#8221; so the command to run it for me looks like this:</p>
<blockquote><p>java -Xmx256m -jar &#8220;F:/Flex SDK/Tools/FlexPMD/flex-pmd-command-line-1.0.RC3.jar&#8221; -s &#8220;F:/THE/DIRECTORY/WHICH/TO/ANALIZE/&#8221; -o . -r &#8220;F:/Flex SDK/Tools/FlexPMD/pmd.xml&#8221;</p></blockquote>
<p>It might be good to point out that you don&#8217;t need to analize the whole project but can also run the tool on any directory in it, which generates files which are easier to read, especially if you&#8217;re just starting to clean a big application.</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=FlexPMD+released+-+http://b2l.me/qhfe8+&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://www.robertbak.com/wordpress/2009/09/flexpmd-released/feed" rel="nofollow" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.robertbak.com/wordpress/2009/09/flexpmd-released/&amp;imageurl=" rel="nofollow" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.robertbak.com/wordpress/2009/09/flexpmd-released/&amp;t=FlexPMD+released" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.robertbak.com/wordpress/2009/09/flexpmd-released/&amp;title=FlexPMD+released&amp;summary=There%27s%20a%20new%20project%20on%20Adobe%20Open%20Source%20called%20FlexPMD%20%28if%20You%27re%20wondering%20what%20PMD%20stands%20for%20the%20answer%20is%20simple%20-%20nothing%29.%20It%27s%20a%20tool%20that%20scans%20Actionsript%20and%20MXML%20code%20and%20points%20out%20bad%20practices%2C%20unused%20variables%2C%20etc.%20Really%20helpfull%20if%20you%27re%20trying%20to%20keep%20the%20code%20clean%20and%20get%20a%20&amp;source=Flex notes" rel="nofollow" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="sexy-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.robertbak.com/wordpress/2009/09/flexpmd-released/&amp;n=FlexPMD+released&amp;pli=1" rel="nofollow" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.robertbak.com/wordpress/2009/09/flexpmd-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Geolocation Library</title>
		<link>http://www.robertbak.com/wordpress/2009/08/geolocation-library/</link>
		<comments>http://www.robertbak.com/wordpress/2009/08/geolocation-library/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 12:16:25 +0000</pubDate>
		<dc:creator>Robert Bak</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[asgeolocation]]></category>
		<category><![CDATA[gears]]></category>
		<category><![CDATA[geolocation]]></category>

		<guid isPermaLink="false">http://www.robertbak.com/wordpress/?p=3</guid>
		<description><![CDATA[Yesterday I&#8217;ve started to experiment with geolocation features built into Firefox 3.5 (check here) and Chrome with Gears installed. What was ment as a Flex Cookbook post grew into a handy library. It supports both Firefox and Chrome (including the loading of the address), includes functions to check the users geolocation, track him, etc. For [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I&#8217;ve started to experiment with geolocation features built into Firefox 3.5 (check <a href="http://www.mozilla.com/firefox/geolocation/">here</a>) and Chrome with Gears installed. What was ment as a Flex Cookbook post grew into a handy library. It supports both Firefox and Chrome (including the loading of the address), includes functions to check the users geolocation, track him, etc.</p>
<p>For the geolocation to work you need to have some javascript code in your page, the library injects the code into the DOM so that you don&#8217;t need to do it manually, for those of you who are interested how to do it here&#8217;s a <a href="http://www.adobe.com/cfusion/communityengine/index.cfm?event=showDetails&amp;postId=7183&amp;productId=2" >cookbook post</a>.</p>
<p>The project is hosted on Google Code  <a href="http://code.google.com/p/asgeolocation/">here</a>, where you can also find a detailed documentation. Below you can find a sample application.</p>
<p>A simplest example I could think off:</p>
<div class="codecolorer-container mxml geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="mxml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span><br />
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span><br />
<span style="color: #000000;"> &nbsp; &nbsp; &nbsp;xmlns:geolocation=<span style="color: #ff0000;">&quot;com.robertbak.geolocation.*&quot;</span></span><br />
<span style="color: #000000;"> &nbsp; &nbsp; &nbsp;creationComplete=<span style="color: #ff0000;">&quot;geo.send()&quot;</span><span style="color: #7400FF;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;geolocation:GeoLocator</span> id=<span style="color: #ff0000;">&quot;geo&quot;</span></span><br />
<span style="color: #000000;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;applicationID=<span style="color: #ff0000;">&quot;YOUR_APPLICATION_ID_HERE&quot;</span><span style="color: #7400FF;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Label</span> text=<span style="color: #ff0000;">&quot;Lat: {geo.lastResult.coords.latitude}&quot;</span><span style="color: #7400FF;">/&gt;</span></span><br />
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></div></div>
<p>As you can see the whole configuration consists of adding the library and setting the applicationID, it&#8217;s usually the same as your main class name (eg. if you create an application as App.mxml, the applicationID should be set to &#8220;App&#8221;). This is needed so that javascript in the DOM of the page can call your application with the results.</p>
<p>The lastResult implements the IPosition interface:</p>
<div class="codecolorer-container actionscript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">IPosition<br />
&nbsp; &nbsp; <span style="color: #66cc66;">*</span> coords <span style="color: #66cc66;">&#40;</span>ICoordinates<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o latitude <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o longitude <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o altitude <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o accuracy <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o altitudeAccuracy <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o heading <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o speed <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">*</span> address <span style="color: #66cc66;">&#40;</span>IAddress<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o streetNumber <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o street <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o premises <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o city <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o county <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o region <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o country <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o countryCode <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">*</span> timestamp <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Date</span><span style="color: #66cc66;">&#41;</span></div></div>
<p style="text-align: center;"><a href="http://robertbak.com/geolocation/Geolocation.html" ><img class="size-full wp-image-7 aligncenter" title="asgeolocator" src="http://www.robertbak.com/wordpress/wp-content/uploads/2010/02/Untitled-2.png" alt="asgeolocator" /></a></p>
<p style="text-align: center;">Sample (view source enabled): <a href="http://robertbak.com/geolocation/Geolocation.html" >link</a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Geolocation+Library+-+http://b2l.me/qhfe9+&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://www.robertbak.com/wordpress/2009/08/geolocation-library/feed" rel="nofollow" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.robertbak.com/wordpress/2009/08/geolocation-library/&amp;imageurl=" rel="nofollow" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.robertbak.com/wordpress/2009/08/geolocation-library/&amp;t=Geolocation+Library" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.robertbak.com/wordpress/2009/08/geolocation-library/&amp;title=Geolocation+Library&amp;summary=Yesterday%20I%27ve%20started%20to%20experiment%20with%20geolocation%20features%20built%20into%20Firefox%203.5%20%28check%20here%29%20and%20Chrome%20with%20Gears%20installed.%20What%20was%20ment%20as%20a%20Flex%20Cookbook%20post%20grew%20into%20a%20handy%20library.%20It%20supports%20both%20Firefox%20and%20Chrome%20%28including%20the%20loading%20of%20the%20address%29%2C%20includes%20functions%20to%20check&amp;source=Flex notes" rel="nofollow" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="sexy-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.robertbak.com/wordpress/2009/08/geolocation-library/&amp;n=Geolocation+Library&amp;pli=1" rel="nofollow" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

]]></content:encoded>
			<wfw:commentRss>http://www.robertbak.com/wordpress/2009/08/geolocation-library/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
