<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Flexuous</title>
	<atom:link href="http://blog.flexuous.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexuous.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 14 Dec 2011 16:20:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.flexuous.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Flexuous</title>
		<link>http://blog.flexuous.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.flexuous.com/osd.xml" title="Flexuous" />
	<atom:link rel='hub' href='http://blog.flexuous.com/?pushpress=hub'/>
		<item>
		<title>What does [Bindable] mean in ActionScript?</title>
		<link>http://blog.flexuous.com/2011/03/07/what-does-bindable-mean-in-actionscript/</link>
		<comments>http://blog.flexuous.com/2011/03/07/what-does-bindable-mean-in-actionscript/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 17:20:59 +0000</pubDate>
		<dc:creator>justinohms</dc:creator>
				<category><![CDATA[AIR (Adobe Integrated Runtime)]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[StackOverflow]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Bindable]]></category>
		<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[flash builder 4]]></category>
		<category><![CDATA[flexbuilder]]></category>
		<category><![CDATA[mxml]]></category>

		<guid isPermaLink="false">http://blog.flexuous.com/?p=216</guid>
		<description><![CDATA[I&#8217;ve been hanging out a bit lately over at Stack Overflow answering questions, earning badges, etc.  I love to find older questions that have incomplete answers or answers that could be expounded upon.   Here is the latest question I &#8230; <a href="http://blog.flexuous.com/2011/03/07/what-does-bindable-mean-in-actionscript/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=216&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been hanging out a bit lately over at Stack Overflow answering questions, earning badges, etc.  I love to find older questions that have incomplete answers or answers that could be expounded upon.   Here is the latest question I wrote an answer for.</p>
<p><strong><em>What does [Bindable] mean in ActionScript?</em></strong></p>
<p>You can either read my answer here or <a title="What does [Bindable] mean in ActionScript" href="http://stackoverflow.com/questions/3959546/what-does-bindable-mean-in-actionscript/5183839#5183839" target="_blank">over on Stack Overflow</a>.</p>
<hr />
<p><strong>[Bindable]</strong> is a one of several meta tags that you can use in flex ActionScript code. It can be applied to properties, or methods that are marked in any scope. It cannot be used with static class members.</p>
<p>The key to useing the <strong>[Bindable]</strong> meta tag is understanding what is going on under the hood when you use it. Essentially using data binding is a type of short hand for adding event listeners and dispatching events.</p>
<p>There are two basic forms of the <strong>[Bindable]</strong> tag. The first is just <strong>[Bindable]</strong> followed by a var/property declaration. The Second is <strong>[Bindable(event="eventname")]</strong> followed by either a var/property declaration, a function/method declaration or one half of a getter/setter declaration.</p>
<p>I&#8217;ll explain the longer notation first since the other builds on the same concept but with even more short hand.</p>
<p><span id="more-216"></span></p>
<p>When you use <strong>[Bindable(event="eventname")]</strong> you are essentially telling the compiler that this var/property/function/method (call this the instance member) is &#8216;available&#8217; to be used as the source for data binding. You are also telling it that when the value of the instance member has been invalidated/changed and it needs to be re-read that the &#8220;eventname&#8221; event will be dispatched.<br />
In this longer form this all you are doing. You the developer are responsible for actually dispatching the &#8220;eventname&#8221; event whenever the value needs to be updated in the binding subscribers.</p>
<p>The real efficiency of using data binding comes on the subscribing side. The typical notation you will see in MXML is <strong>value=&#8221;{instance.propertyName}&#8221;</strong> When you use the notation <strong>{ }</strong> you are telling the compiler to do the following:</p>
<ol>
<li>Create an event listener that listens to the event named in the bindable meta tag</li>
<li>In that event listener re-read the instance.propertyName and update this value</li>
</ol>
<p>If you use the shorter form <strong>[Bindable]</strong>, and you add the tag before a property/var, the compiler fills in the blanks and adds some additional functionality to make the property bindable. Essentially you are telling the compiler <em>&#8220;add the events and methods you need to make this property bindable&#8221;</em><br />
Now the way to think of what the compiler will do under the hood is this.</p>
<ol>
<li>make a private version of your var</li>
<li>create an &#8220;event&#8221; to trigger the binding</li>
<li>create a getter function with scope and name of your original var that returns the private verson of the var when called.</li>
<li>create a setter function with scope and name of your original var that sets the private version of the var when called AND dispatches the triggering event.</li>
</ol>
<p>In essence the compiler will do much of the work for you.</p>
<p><pre class="brush: as3;">
[Bindable]
public var xyz
</pre></p>
<p>is equivalent to</p>
<p><pre class="brush: as3;">
private var _xyz:String;

[Bindable(event=&quot;updateXYZValue&quot;)]
public function get xyz():String{
return _xyz;
}

public function set xyz(newxyz:String):void{
_xyz = newxyz;
dispatchEvent(new Event(&quot;updateXYZValue&quot;));
}
</pre></p>
<p>The only functional differences in these is that in the first instance;</p>
<ol>
<li>you do not know the name of the event that will be dispatched to trigger the binding</li>
<li>there is no way to update the underlying value <em>without</em> triggering the data binding</li>
</ol>
<p>This second example also demonstrates one special case of the <strong>[Bindable]</strong> meta tag. This is that when you are applying it to a getter/setter pair defined for the same variable name you need only apply it to one or the other, it will apply to both. Typically you should set it on the getter.</p>
<p>You can use either notation on a function/method however if you do not specify an event the binding will never be triggered so if you are trying to bind to a function you should alway specify an event. It is also possible to specify more than one triggering event by stacking the tag. eg.</p>
<p><pre class="brush: as3;">
[Bindable(event=&quot;metaDataChanged&quot;)]
[Bindable(event=&quot;metaObjectUpdated&quot;)]
public function readMyMetaData():MetaDataObject{
var myMetaDataObject:MetaDataObject;
.
.
.

return myMetaDataObject;
}

</pre></p>
<p>This would presume that somewhere else you your class you will dispatch this <em>metaDataChanged</em> event or the <em>metaObjectUpdated</em> event when you want trigger the binding.</p>
<p>Also note that with this notation you can tie the binding of any instance member to any event that the instance will dispatch. Even inherited events that you yourself do not generate such as FrameEnter, OnChange, etc&#8230;</p>
<p>Data bindings can also be setup and destroyed during runtime. If you are interested in this take a look at the mx.binding.utils classes.</p>
<p><a href="http://stackoverflow.com/questions/3959546/what-does-bindable-mean-in-actionscript/5183839#5183839">http://stackoverflow.com/questions/3959546/what-does-bindable-mean-in-actionscript/5183839#5183839</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexuous.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexuous.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexuous.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexuous.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexuous.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexuous.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexuous.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexuous.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexuous.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexuous.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexuous.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexuous.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexuous.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexuous.wordpress.com/216/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=216&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.flexuous.com/2011/03/07/what-does-bindable-mean-in-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/265f8fef23f99b7192248b37c2c584ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">justinohms</media:title>
		</media:content>
	</item>
		<item>
		<title>DRY or DIE</title>
		<link>http://blog.flexuous.com/2011/01/27/dry-or-die/</link>
		<comments>http://blog.flexuous.com/2011/01/27/dry-or-die/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 17:45:17 +0000</pubDate>
		<dc:creator>justinohms</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.flexuous.com/?p=214</guid>
		<description><![CDATA[Am I the only one that find&#8217;s it ironic that there are TWO terms for this same concept&#8230; http://en.wikipedia.org/wiki/Don&#8217;t_repeat_yourself<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=214&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Am I the only one that find&#8217;s it ironic that there are TWO terms for this same concept&#8230;</p>
<p><a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself">http://en.wikipedia.org/wiki/Don&#8217;t_repeat_yourself</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexuous.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexuous.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexuous.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexuous.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexuous.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexuous.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexuous.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexuous.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexuous.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexuous.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexuous.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexuous.wordpress.com/214/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexuous.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexuous.wordpress.com/214/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=214&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.flexuous.com/2011/01/27/dry-or-die/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/265f8fef23f99b7192248b37c2c584ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">justinohms</media:title>
		</media:content>
	</item>
		<item>
		<title>laptop &#8220;plugged in, not charging&#8221;</title>
		<link>http://blog.flexuous.com/2011/01/13/laptop-plugged-in-not-charging/</link>
		<comments>http://blog.flexuous.com/2011/01/13/laptop-plugged-in-not-charging/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 01:31:49 +0000</pubDate>
		<dc:creator>justinohms</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.flexuous.com/?p=211</guid>
		<description><![CDATA[Oh crap! your laptop says &#8220;plugged in not charging&#8221; when you hover over the battery icon.  It turns out that you probably do not have anything to worry about.Many newer laptops and batteries are designed not to charge to frequently. &#8230; <a href="http://blog.flexuous.com/2011/01/13/laptop-plugged-in-not-charging/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=211&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Oh crap! your laptop says &#8220;plugged in not charging&#8221; when you hover over the battery icon.  It turns out that you probably do not have anything to worry about.<span id="more-211"></span>Many newer laptops and batteries are designed not to charge to frequently. Several posts I have found across the internet mention a common &#8220;80% charge&#8221; feature.  This feature keeps a battery&#8217;s maximum charge level to 80% in order to extend longevity.  Most of the time if you have this feature you can turn it off or on.</p>
<p>There are not many mentions of another common feature.  This feature prevents a battery from charging unless the battery is below 90%.  This means that if you battery meter says 91% and &#8220;plugged in, not charging&#8221; you might not need to be concerned.</p>
<p>To test if your system is one of these, unplug and use your laptop till it gets down to say 85%, then plug it in.  Wait a minute or two before you check the status.  If your laptop is one that has this feature you should now see &#8220;plugged in charging&#8221;.</p>
<p>Oddly enough you should consider yourself lucky, this means that your laptop is taking special care of your battery to make it last longer.  The more you charge and discharge a battery the more you degrade it&#8217;s performance over time.  This is particularly true of small discharges and recharges. By not charging unless the battery is below 90% you won&#8217;t wear out your battery when you unplug your laptop for a short period of time, like moving it from one room to another.</p>
<p>I just wanted to share this because I had this happen and everything I read online talks about hardware problems or windows driver problems.  Just try this out first to see if you even need to be worried.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexuous.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexuous.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexuous.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexuous.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexuous.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexuous.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexuous.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexuous.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexuous.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexuous.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexuous.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexuous.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexuous.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexuous.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=211&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.flexuous.com/2011/01/13/laptop-plugged-in-not-charging/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/265f8fef23f99b7192248b37c2c584ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">justinohms</media:title>
		</media:content>
	</item>
		<item>
		<title>Migrating from Subversive to Subclipse in eclipse</title>
		<link>http://blog.flexuous.com/2011/01/05/migrating-from-subversive-to-subclipse-in-eclipse/</link>
		<comments>http://blog.flexuous.com/2011/01/05/migrating-from-subversive-to-subclipse-in-eclipse/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 18:25:49 +0000</pubDate>
		<dc:creator>justinohms</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[AIR (Adobe Integrated Runtime)]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.flexuous.com/?p=204</guid>
		<description><![CDATA[I recently decided to migrate from Subversive to Subclipse  as my SVN plugin for FlashBuilder (eclipse)  I found it to be a very easy process.   I found the video Migrating from Subversive to Subclipse in Servoy 5 to be especially &#8230; <a href="http://blog.flexuous.com/2011/01/05/migrating-from-subversive-to-subclipse-in-eclipse/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=204&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently decided to migrate from Subversive to Subclipse  as my SVN plugin for FlashBuilder (eclipse)  I found it to be a very easy process.   I found the video <a title="Migrating from Subversive to Subclipse in Servoy 5" href="http://guides.roclasi.com/subversive2subclipse/" target="_blank">Migrating from Subversive to Subclipse in Servoy 5</a> to be especially useful.</p>
<address><span style="color:#008000;">For those people like myself that didn&#8217;t know&#8230;. Servoy Developer is apparently an eclipse based  IDE  / plug-in, that is not unlike FlashBuilder.   (</span><a href="http://en.wikipedia.org/wiki/Servoy"><span style="color:#008000;">http://en.wikipedia.org/wiki/Servoy</span></a><span style="color:#008000;">)</span></address>
<p>Since Servoy is eclipse and FlashBuilder is eclipse the process is almost exactly the same.  The only difference being that instead of the Servoy Solution explorer you use the Project Explorer.</p>
<p>If you are curious as to why I decided to migrate to Subclipse; it mostly has to do with the failing of Subversive to properly integrate refactoring changes (moves) into the SVN repository.   I use the eclipse automated refactoring frequently in the initial stages of a projects as I play with different package structures.  The Subversive method of handling a move is to post two  distinct SVN actions a delete and an add.  This looses any history attachment and is not &#8216;proper&#8217; in my opinion.  (You can get around this by doing the SVN move outside of eclipse and then doing the refactor, but IMO this is just lame. )   I haven&#8217;t tried it yet but apparently Subclipse integrates closer to eclipse so that it will properly handle refactoring.  (Most people suggest that you do an update before and commit after the re-factor. )</p>
<p>When you look at the way each of these came about it makes sense.  Subversive was written by eclipse people to connect to SVN while Subclipse was written from the SVN perspective.  If you are primarily concerned with SVN then move is a really important function (to maintain history)  where as if you are coming at it from the IDE side of things it might not be as important and the easier delete/add would be sufficient.</p>
<p>I am in no way putting down Subversive, it is a great tool, and works well particularly if you don&#8217;t plan on doing any refactoring, then again who &#8220;plans&#8221; on refactoring</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexuous.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexuous.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexuous.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexuous.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexuous.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexuous.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexuous.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexuous.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexuous.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexuous.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexuous.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexuous.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexuous.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexuous.wordpress.com/204/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=204&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.flexuous.com/2011/01/05/migrating-from-subversive-to-subclipse-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/265f8fef23f99b7192248b37c2c584ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">justinohms</media:title>
		</media:content>
	</item>
		<item>
		<title>Chaining bindable properties in ActionScript using anonymous functions.</title>
		<link>http://blog.flexuous.com/2010/11/24/chaining-bindable-properties-in-actionscript-using-anonymous-functions/</link>
		<comments>http://blog.flexuous.com/2010/11/24/chaining-bindable-properties-in-actionscript-using-anonymous-functions/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 23:22:42 +0000</pubDate>
		<dc:creator>justinohms</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[AIR (Adobe Integrated Runtime)]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.flexuous.com/?p=196</guid>
		<description><![CDATA[Imagine that you have an object that exposes a public property that is bindable.   Now imagine you have a second object that uses this bindable property to provide it&#8217;s own bindable property.  How do you simply and easily bind a UI &#8230; <a href="http://blog.flexuous.com/2010/11/24/chaining-bindable-properties-in-actionscript-using-anonymous-functions/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=196&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Imagine that you have an object that exposes a public property that is bindable.   Now imagine you have a second object that uses this bindable property to provide it&#8217;s own bindable property.  How do you simply and easily bind a UI element to this property on the second object, so that when the first object&#8217;s property updates, the UI updates.</p>
<p>A couple of months ago I was working on a project using the ExtJS framework in JavaScript. I came to appreciate one particular feature in JavaScript that is commonly used there and while somewhat available in ActionScript is not as commonly used here in the AS world.  This is the use of <em>anonymous functions</em> and <em>method injection</em>.  Now back in the days of pre OO, AS2  Anonymous functions actually were rather common. However with the advent of AS3 and classes no longer being dynamic by default the use of things like anonymous functions and method injection has really gone away.  With the move toward a real OO language it can be argued that this is a good thing.  I&#8217;m never one to strictly stick with a prescribed architecture or pattern, and this include things like these that might make some OO purists wince.  However living in the real world I have to go with what works and makes my life easier. Sometimes that means crossing the street where there is not a crosswalk.<span id="more-196"></span></p>
<p>So the particular problem I was having was fairly straight forward and easy to understand particularly if you</p>
<p>A. use bindings in your ActionScript</p>
<p>and</p>
<p>B. if you understand how the AS events model relates to binding.</p>
<p><span style="color:#800000;"><em><strong> If you are using bindings but don&#8217;t understand the event model relationship, I recommend doing some research into into it and getting familiar with how it works.</strong></em></span></p>
<p>Now to restate the problem.  You have an object that exposes a public property that is bindable.   You have a second object that uses this bindable property to provide it&#8217;s own bindable property (or method).  How do you simply and easily bind a UI element to this property on the second object, so that when the first object&#8217;s property updates, the displayed value updates.</p>
<p>The easy way to do this is to create the binding to object 1 in the UI (MXML in this case)  in such away that you pass the first object&#8217;s property as a parameter to a method of the second object. This method then returns the value you seek.  If this is then defined in a binding  i.e. <span style="color:#0000ff;">&#8220;{obj2.someMethod(obj1.prop)}&#8221;</span> then the binding will update when the first object&#8217;s property updates, but the value will come from object 2 (obj2.method may or may  not actually use the obj1.prop as part of the result)</p>
<p>Now this is all well and good however it&#8217;s not very clean in my opinion.   If you are familiar with how bindings work with events, you are aware that bindings simply execute when events are dispatched. Therefore if there is a binding, there is a corresponding event that is causing the binding-destination to fetch the new value from the binding-source.</p>
<p>You could then easily create a  method inside of obj2, attach that method using addEventListener to the event that corresponds to the binding on the obj1 property.  This method in obj2 could then create and fire a new event (or rebroadcast the event from obj1)  for which a property on obj2 would have it&#8217;s binding event set too.  <em>(If that didn&#8217;t make any sense go read up on how bindings and events work.)</em></p>
<p>Now again nothing wrong with that approach.  Only thing that bothers me about that is every time I want to do this, all of my obj2 type classes have to have this one method that basically does nothing other than rebroadcast an event from obj1.  In my case I might end up with hundreds of classes that would be in this situation which means this same stupid method duplicated hundreds of time.  Anytime I get the wiff of code duplication, I start looking for a more efficient way of doing things.</p>
<p>The solution is an anonymous function provided by the originator of the event (obj1) and added to the dependent object (obj2).    To do this, I created an addDelgate method to the originator, for each event that I want chain.  This event takes as a parameter an object that implements IEventDispatcher and returns a handle to an anonymous function.  Here is an example of that method.</p>
<p><pre class="brush: as3; light: true; wrap-lines: false;">
public function addDelegate_NewLoaded(that:IEventDispatcher):Function
{
   var f:Function = function(e:NewLoadedEvent):void {
                         that.dispatchEvent(new NewLoadedEvent());
                    }

   this.addEventListener(NewLoadedEvent.NEW_LOADED,f,false,0,true);
   return f
}
</pre></p>
<p>Now if you notice all this does is create an object <span style="color:#ff9900;">f</span> of type function. The function <span style="color:#ff9900;">f</span> does only one thing, create a new instance of <span style="color:#339966;"><em>NewLoadedEvent</em> </span>and dispatch it using the provided IEventDispatcher object <span style="color:#3366ff;">that</span>.  We then attach this function <span style="color:#ff9900;">f</span> as a listener to <span style="color:#339966;">NewLoadedEvent </span>of <span style="color:#3366ff;">this</span>. Then, just so we don&#8217;t loose it, we return a handle to the function to the caller.  (The caller can either keep or discard the handle as needed.)   So in the caller (obj2) we would call this like this:</p>
<p><pre class="brush: as3; light: true; wrap-lines: false;">

[Bindable(event=&quot;newLoaded&quot;)]
public class ObjectTwo extends EventDispatcher
{
   private var obj1:ObjectOne
   private var fProxy:Function
   public var property1:String = '';
   public var property2:Number = 0;
   public function ObjectTwo()
   {
     obj1 = new ObjectOne();
     fProxy = obj1.addDelegate_NewLoaded(this);
   }
   public function someMethod():Number
   {
      return obj1.someMethodReturnsANumber() + this.property2;
   }
}
</pre></p>
<p>Notice that in the constructor of ObjectTwo we are creating an instance of ObjectOne.</p>
<p><span style="color:#808080;"><em>(This  is just for demonstration purposes most likely this object would come from somewhere else, i.e.: a singleton, a factory or be passed into constructor.)</em></span></p>
<p>We are then calling the <em>addDelegate_NewLoaded </em>method on the instance of ObjectOne and passing in a reference to <em>this </em>instance of ObjectTwo.  We keep a handle to the resulting anonymous function as <span style="color:#ff9900;"><em>fProxy</em></span>.   The other thing you should notice is that the entire class is marked as <strong>Bindable </strong>on the event <span style="color:#339966;"><em>newLoaded</em></span>.  This means that anytime this (i.e. this instance of object2) dispatches the newLoaded event, all bindings that use properties or methods of this object as the source of the binding will be re evaluated.  This is where the magic happens.  Notice that object2 doesn&#8217;t actually have any code to dispatch this particular event.  This is because thanks to that <span style="color:#993366;">addDelegate_NewLoaded</span> method on ObjectOne, the <em><strong>obj1 will dispatch the event for us, <span style="color:#ff6600;">but using obj2 as the source / eventDispatcher</span>.</strong></em></p>
<p>Now I&#8217;ve left out a bunch of stuff out here; import statements,   <a title="Flex Events and FlashBuilder Event Meta Tags" href="http://blog.flexuous.com/2010/11/12/flex-events-and-flashbuilder-event-meta-tags/">Event Meta Tags</a> , but you should get the picture.  Just in case there is any confusion about what this accomplishes.  You would now be able to write your binding simply as <span style="color:#0000ff;">&#8220;{obj2.method()}&#8221;</span> or you could bind to any other property or method on obj2 and know that these bindings would update whenever obj1 throws the <span style="color:#339966;"><em>newLoaded </em></span>event.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexuous.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexuous.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexuous.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexuous.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexuous.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexuous.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexuous.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexuous.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexuous.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexuous.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexuous.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexuous.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexuous.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexuous.wordpress.com/196/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=196&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.flexuous.com/2010/11/24/chaining-bindable-properties-in-actionscript-using-anonymous-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/265f8fef23f99b7192248b37c2c584ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">justinohms</media:title>
		</media:content>
	</item>
		<item>
		<title>Flex Events and FlashBuilder Event Meta Tags</title>
		<link>http://blog.flexuous.com/2010/11/12/flex-events-and-flashbuilder-event-meta-tags/</link>
		<comments>http://blog.flexuous.com/2010/11/12/flex-events-and-flashbuilder-event-meta-tags/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 22:09:13 +0000</pubDate>
		<dc:creator>justinohms</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[AIR (Adobe Integrated Runtime)]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.flexuous.com/?p=166</guid>
		<description><![CDATA[As so many of these things go I&#8217;m sure this information is out there somewhere&#8230; I&#8217;ve even probably read it.   For whatever reason it didn&#8217;t &#8220;click&#8221; for me.   I figured out how to effectively leverage the Flex Event &#8230; <a href="http://blog.flexuous.com/2010/11/12/flex-events-and-flashbuilder-event-meta-tags/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=166&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As so many of these things go I&#8217;m sure this information is out there somewhere&#8230; I&#8217;ve even probably read it.   For whatever reason it didn&#8217;t &#8220;click&#8221; for me.   I figured out how to effectively leverage the Flex Event meta tags in FlexBuilder.</p>
<p>Now I&#8217;m not going to get into <em>why </em> you should use an event architecture&#8230; there are lots of articles on that and I&#8217;m sure by this time most developers are using events.  I will lay out my preference on how to set up events.</p>
<p>So if you are not familiar with it there is this neat little meta tag for attaching events to the a dispatcher.  The tag looks something like this:</p>
<p><pre class="brush: as3; light: true;">

[Event(name=&quot;someEventName&quot;,type=&quot;com.some.thing.fooEvent&quot;)]

</pre></p>
<p>Now as meta tags go this one is NOT required by the compiler (as opposed to say <span style="color:#0000ff;">[Bindable]</span> ) so it is completely optional. However if you are using FlashBuilder let me tell you what magic happens when you do use it correctly.</p>
<p><span id="more-166"></span></p>
<p>First let me talk a bit about how I like to create events.   I&#8217;ve become quite fond of creating individual event classes for each event type of event I want to dispatch.  Confused?  Well there are two approaches to creating custom event classes that I&#8217;ve seen floating about.  The first creates a custom event class that has a number of constant values that can be passed into the constructor for the event type.  It looks something like this:</p>
<p><pre class="brush: as3; wrap-lines: false;">
package com.some.thing.foo {
	import flash.events.Event;
	public class FooEvent extends Event	{
		public static const OPEN_FOO_EVENT:String = &quot;openFooEvent&quot;;
		public static const CLOSE_FOO_EVENT:String = &quot;closeFooEvent&quot;;
		public function FooEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
		{
			super(type, bubbles, cancelable);
		}
	}
}
</pre></p>
<p>Now to create an event of this type you call  it something like this.  (from inside of your class that extends event dispatcher):</p>
<p><pre class="brush: as3; light: true; wrap-lines: false;">
import com.some.thing.foo.FooEvent
dispatchEvent(new FooEvent(FooEvent.OPEN_FOO_EVENT));
</pre></p>
<p>Now there is nothing really wrong with this&#8230;. except it doesn&#8217;t do much for you and here is why.</p>
<p>First imagine that you have 50 different events you want to dispatch that do not include any additional data other than the fact that the event was dispatched.  Ok so you create an event class like the above FooEvent class, add 50 different constants and there you go.   Great, but what a waste.  You could have done basically the same thing by simply putting the constants in your dispatcher class and creating a generic event.  Ala&#8230;</p>
<p><pre class="brush: as3; light: false; wrap-lines: false;">
import flash.events.Event;
public static const OPEN_FOO_EVENT:String = &quot;openFooEvent&quot;;
public static const CLOSE_FOO_EVENT:String = &quot;closeFooEvent&quot;;
dispatchEvent(new Event(OPEN_FOO_EVENT));
</pre></p>
<p>Didn&#8217;t really do much except for add a new class that does nothing.  Either way you have to pass the constant in to the event to make sure it gets the right type.</p>
<p>Now imagine the other scenario.  This is the situation where you want to include some data along with the event.  Your event might look like this.</p>
<p><pre class="brush: as3; wrap-lines: false;">
package com.some.thing.foo {
       import flash.events.Event;
       public class BarEvent extends Event
       {
          public static const OPEN_BAR_EVENT:String = &quot;openBarEvent&quot;;
          public static const CLOSE_BAR_EVENT:String = &quot;closeBarEvent&quot;;
          public var phooy:String = &quot;&quot;;
          public function BarEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
          {
              super(type, bubbles, cancelable);
          }
       }
}
</pre></p>
<p>or this</p>
<p><pre class="brush: as3; wrap-lines: false;">
package com.some.thing.foo {
       import flash.events.Event;
       public class Bar2Event extends Event
       {
          public static const OPEN_BAR_EVENT:String = &quot;openBarEvent&quot;;
          public static const CLOSE_BAR_EVENT:String = &quot;closeBarEvent&quot;;
          private var _phooy:String = &quot;&quot;;
          public function Bar2Event(phooy:String, type:String, bubbles:Boolean=false, cancelable:Boolean=false)
          {
             this._phooy = phooy;
             super(type, bubbles, cancelable);
           }
           public function get phooy():String{
               return this._phooy;
           }
       }
}
</pre></p>
<p>Now you would dispatch these like this:</p>
<p><pre class="brush: as3; light: true; wrap-lines: false;">
import com.some.thing.foo.BarEvent
import com.some.thing.foo.Bar2Event

   //For BarEvent
   var b:BarEvent = new BarEvent(BarEvent.OPEN_BAR_EVENT);
   b.phooy = &quot;iphoney&quot;;
   dispatchEvent(b);

   //or for Bar2Event
   dispatchEvent(new Bar2Event(&quot;iphone home&quot;,Bar2Event.CLOSE_FOO_EVENT));
</pre></p>
<p>The question you have to ask yourself is;  Does either of these really help things, or do these methods make your code harder to read?</p>
<p>There is a better way&#8230;..Create individual event classes for each of your events.</p>
<p>Now before I go down that path I will say there is one benefit of doing things like the foo class above.  You have the ability to use the <em><strong>is</strong></em> operator to check for a common class type.  Which can come in handy somewhere in your code.  You might want your event handler to handle both foo open event and file open event and branch execution by type.  Ok so  to keep that ability (and just to make things clean) I&#8217;ll do the same thing.  The way I like to handle this is by creating a directory  and package structure like this.</p>
<p>com.some.thing.foo</p>
<p>com.some.thing.foo.<strong>FooBarDispatcher.as</strong></p>
<p>com.some.thing.foo.events</p>
<p>com.some.thing.foo.events.<strong>FooEvent.as</strong> (extends flash.events.Event)</p>
<p>com.some.thing.foo.events.<strong>FooOpenEvent.a</strong>s     (extends  FooEvent)</p>
<p>com.some.thing.foo.events.<strong>FooCloseEvent.as</strong> (extends FooEvent)</p>
<p>Now since we don&#8217;t have abstract classes in AS you just have to restrain yourself from directly creating the FooEvent or implement some sort of abstract enforcer at runtime.  For this I don&#8217;t bother since I <em>might </em>at some point want to directly dispatch a FooEvent.  (seems unlikely but who knows)</p>
<p>So now all my events will be FooEvents by inheritance.    If  I want to throw errors  I will also create a FooErrorEvent class  (extending flash.events.ErrorEvent )  and use that as the parent class for error events.</p>
<p>The FooEvent class here looks almost exactly like the first foo event class in this post <em><strong>except there are no constants</strong></em> in it.    Instead we define one and only one constant in each sub-class.</p>
<p><pre class="brush: as3; wrap-lines: false;">
package com.some.thing.foo.events
{
    public class FooOpenEvent extends FooEvent
        {
         public static const FOO_OPEN_EVENT:String = &quot;fooOpenEvnet&quot;;
         public function FooOpenEvent()
         {
             super(FOO_OPEN_EVENT);
         }
    }
}
</pre></p>
<p>Dispatched like this:</p>
<p><pre class="brush: as3; light: true; wrap-lines: false;">
import com.some.thing.foo.events.*
dispatchEvent(new FooOpenEvent());
</pre></p>
<p>There are a couple of ways this makes the code cleaner.  First in the event class itself, no import statement is needed since the parent class is in the same package.  A small difference but small differences add up.</p>
<p>The next point of clarity  is that the line needed to dispatch the event is very clear.  All I need to know is right in front of me.  I don&#8217;t need to know where to get the constant.  I don&#8217;t need to know what constants are permissible.  I just create and dispatch the event.</p>
<p>Also in the event class you will notice that the event type that is passed to the parent class constructor&#8217;s type argument is fixed.  The type of this event will ALLWAYS be &#8220;fooOpenEvent&#8221;   This makes the code else where easy to read.  When you  have a listener that is getting an event of type  &#8221;FooOpenEvent&#8221;, it is always a &#8220;fooOpenEvent&#8221;.    The the first example, a FooEvent could be either a &#8220;fooOpenEvent&#8221; or a &#8220;fooCloseEvent&#8221;.   This distinction isn&#8217;t so important for the compiler, internally it looks at the type string to determine event type, however for you in reading your code  think about this&#8230;.</p>
<p><pre class="brush: as3; light: true; wrap-lines: false;">
public function handleFooOpen(e:FooEvent){
   //Am I handleing the right event?...   e.Type?
   //the compiler won't throw an error if I'm wrong.
}
public function handleFooClose(e:FooEvent){
   //Am I handleing the right event?... e.Type?
   //the compiler won't throw an error if I'm wrong.
}
//versus the clarity of
public function handleFooOpen(e:FooOpenEvent){
   //I'm sure I have the right event or it won't compile.
}
public function handleFooClose(e:FooCloseEvent){
   //I'm sure I have the right event or it won't compile.
}
</pre></p>
<p>So think a bit about the above code.   The first two handlers would be what you would use with the first foo event class listed at the beginning of this post.   Notice how since they both take the same type (FooEvent) that if you were to accidently set up your <strong>addEventListener</strong> incorrectly you wouldn&#8217;t know it.  For example, considering the first two event handlers above.</p>
<p><pre class="brush: as3; light: true; wrap-lines: false;">
//This is what you want....
fooBarInstance.addEventListener(FooEvent.OPEN_FOO_EVENT,handleFooOpen);
fooBarInstance.addEventListener(FooEvent.CLOSE_FOO_EVENT,handleFooClose);
//But this would be valid too... the compiler would be just happy
fooBarInstance.addEventListener(FooEvent.OPEN_FOO_EVENT,handleFooClose);
fooBarInstance.addEventListener(FooEvent.CLOSE_FOO_EVENT,handleFooOpen);
</pre></p>
<p>In contrast, the last two handlers use different types, so if you try to attach them as event listeners to the incorrect type of event, the pre-compiler in FlashBuilder will report a problem.  For example&#8230; (considered with the last two event handlers from above)</p>
<p><pre class="brush: as3; light: true; wrap-lines: false;">
//This would work....
fooBarInstance.addEventListener(FooOpenEvent.FOO_OPEN_EVENT,handleFooOpen);
fooBarInstance.addEventListener(FooCloseEvent.FOO_CLOSE_EVENT,handleFooClose);
//But the compiler wouldn't like this....
fooBarInstance.addEventListener(FooOpenEvent.FOO_OPEN_EVENT,handleFooClose);
fooBarInstance.addEventListener(FooCloseEvent.FOO_CLOSE_EVENT,handleFooOpen);
</pre></p>
<p>Where this really helps code readability is when you want to include some sort of payload data with the event.   I won&#8217;t write the revised event classes out but think of the bar events from before.  If you rewrite them to include the constant in the event and the type is fixed to that constant.  This is what you end up with to dispatch the event .</p>
<p><pre class="brush: as3; light: true; wrap-lines: false;">
import com.some.thing.foo.events.*

   //For BarEvent
   dispatchEvent(new BarEvent(&quot;iphoney&quot;));

   //or for Bar2Event
   dispatchEvent(new Bar2Event(&quot;iphone home&quot;));
</pre></p>
<p>Now that is much easier to read and understand.  Plus the advantage that I just mentioned above about the compiler catching incorrectly assigned event listeners comes into play even more when you have events that carry data.  For example; Imagine that you have an event with a &#8220;status&#8221; property, &#8220;status&#8221; would have quite a different meaning for an open event, close event and a delete event.  You would want to ensure that it is handled correctly.</p>
<p>Ok&#8230;. so this post has gotten pretty long and I haven&#8217;t even gotten to the meta data tag I mentioned before&#8230;. ok now I&#8217;m getting to that.</p>
<p>Basically it comes down to this.  You want to add the following meta data tag before the class definition for each event that your class will dispatch.  For example in my FooBarDispatcher class :</p>
<p><pre class="brush: as3; light: true;">
...
[Event(name=&quot;fooOpenEvent&quot;,type=&quot;com.some.thing.foo.events.FooOpenEvent&quot;)]
[Event(name=&quot;fooCloseEvent&quot;,type=&quot;com.some.thing.foo.events.FooCloseEvent&quot;)]
public class FooBarDispatcher Extends EventDispatcher
{
...
</pre></p>
<p>Now where this comes into play in FlashBuilder is in the auto sense type thingy.</p>
<p>FlashBuilder uses the information in the meta tag above to do a couple of things.  First it uses it to help you auto fill events that an object can dispatch.   So if I opened another class and created an instance of FooBarDispatcher named foosball (of type FooBarDispatcher)  as soon as I then typed the <strong>&#8220;(&#8220;</strong> in <strong> &#8220;foosball.addEventListener(</strong>&#8221;    a list of the available events that could be dispatched by the object (fooOpenEvent, fooCloseEvent) would be displayed.</p>
<p>If I then select one of these events the other bit of magic happens.   Provided I have named my event name, event class, and event type constant correctly defined in the meta tag and the event class, FlashBuilder will automagically enter the correct class and constant value for me.  ie.    <strong>&#8220;FooOpenEvent.FOO_OPEN_EVENT&#8221; </strong> thus I then just have to type in the name of the event handler and all is done.    For reference &#8230;.</p>
<p><pre class="brush: as3; light: true;">
...
private var foosball:FooBarDispatcher = new FooBarDispatcher();
foosball.addEventListener(FooOpenEvent.FOO_OPEN_EVENT, handleFooOpen);
...
</pre></p>
<p>Now the rules for naming the event class, the event name and event type constant are the tricky bit  they are as follows.</p>
<ul>
<li>The type in the meta tag must be point to the class that contains the constant.  This should also be the class of the event type itself.</li>
<li>The name in the meta tag must be the same as the name of the constant in the above class <span style="text-decoration:underline;"><strong>converted to all upper case where  an upper case letter is preceeded by an underscore</strong></span> as in&#8230;<br />
fooOpenEvent -&gt;  FOO_OPEN_EVENT<br />
fooCloseEvent -&gt; FOO_CLOSE_EVENT</li>
<li>To keep things simple and consistent, the string contained in the constant in the event class should be the reverse<br />
FOO_OPEN_EVENT = &#8220;fooOpenEvent&#8221;</li>
</ul>
<p>That&#8217;s it.  Now I should mention that the above method of using the meta tag WILL work just fine with the method of having more than one event type defined in a single event class.  However I hope you see there are other very good reasons to define separate events for each event type.</p>
<p>The extra time it takes to create individual event classes and the time it takes to add the meta tag to your event dispatchers for all the events it dispatches does pay off.   First when you are coding by having the correct event types automatically appear and second by reducing debugging time since bone-headed event handling errors will be caught by the pre-compiler.</p>
<p>PS.  Another  thing this does, is show your events when you use your components in MXML. (If you swing that way.)</p>
<p>PSS.  Almost forgot (this is even more goodness)   By specifying the event meta data you can also add an ASDoc comment to  the event.   Maybe I&#8217;ll write a post about that too someday.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexuous.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexuous.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexuous.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexuous.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexuous.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexuous.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexuous.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexuous.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexuous.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexuous.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexuous.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexuous.wordpress.com/166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexuous.wordpress.com/166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexuous.wordpress.com/166/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=166&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.flexuous.com/2010/11/12/flex-events-and-flashbuilder-event-meta-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/265f8fef23f99b7192248b37c2c584ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">justinohms</media:title>
		</media:content>
	</item>
		<item>
		<title>&#8220;content is not allowed in prolog&#8221;  using Picasa/Google API</title>
		<link>http://blog.flexuous.com/2010/11/03/content-is-not-allowed-in-prolog-using-picasagoogle-api/</link>
		<comments>http://blog.flexuous.com/2010/11/03/content-is-not-allowed-in-prolog-using-picasagoogle-api/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 20:17:00 +0000</pubDate>
		<dc:creator>justinohms</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.flexuous.com/?p=162</guid>
		<description><![CDATA[Ok the problem&#8230;.   getting &#8220;content is not allowed in prolog&#8221; when trying to create an album on Picasa via the Picasa/Google API  from inside of a Flex client. From a bit of googleing   I was able to determine that the &#8230; <a href="http://blog.flexuous.com/2010/11/03/content-is-not-allowed-in-prolog-using-picasagoogle-api/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=162&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ok the problem&#8230;.   getting &#8220;content is not allowed in prolog&#8221; when trying to create an album on Picasa via the Picasa/Google API  from inside of a Flex client.</p>
<p>From a bit of googleing   I was able to determine that the problem was basically that my atom-xml request content was not formed properly.  In particular that the xml content was preceded in the request by &#8220;something&#8221;    Using <a title="Charles Proxy" href="http://www.charlesproxy.com/" target="_blank">Charles </a> I was able to easily determine that the offending piece of data was my oauth signature and other oauth bits.  The problem could best be summed up as the following:<span id="more-162"></span></p>
<ul>
<li>I had been doing oAuth requests to the Picasa API using a POST request.</li>
<li>Because there are issues with the <strong>Authentication </strong>header in Flex/Flash I was sending all oAuth values in the post request.</li>
<li>This was all well and good EXCEPT if  the request needs to be of content type <em>&#8220;application/atom+xml&#8221;</em> because then you get this aforementioned error.</li>
<li>However&#8230; you can&#8217;t make the API call without passing all of the oAuth &#8220;stuff&#8221;</li>
<li>Since I can&#8217;t use the Authentication header (which would be ideal) to pass the oAuth stuff, but I need to get the oAuth stuff out of the body of the POST, how then to do it?&#8230;.</li>
</ul>
<p>Solution, Ah  oh so simple&#8230;.</p>
<p>Leave the request type as a POST (with the content being the atom xml payload), set the content type to <em>&#8220;application/atom+xml&#8221; </em> but pass all of the oAuth as a GET, i.e. as escaped (urlEncoded) values on the URL query string.</p>
<p>Voila!  Request completes and is signed properly etc. etc.</p>
<p>Now just have to get past the fact that Flex thinks a 201 response code is an error and we should have that bit working.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexuous.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexuous.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexuous.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexuous.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexuous.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexuous.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexuous.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexuous.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexuous.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexuous.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexuous.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexuous.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexuous.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexuous.wordpress.com/162/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=162&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.flexuous.com/2010/11/03/content-is-not-allowed-in-prolog-using-picasagoogle-api/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/265f8fef23f99b7192248b37c2c584ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">justinohms</media:title>
		</media:content>
	</item>
		<item>
		<title>Fujitsu Tablet Button issue on Windows 7 x64</title>
		<link>http://blog.flexuous.com/2010/10/31/fujitsu-tablet-button-issue-on-windows-7-x64/</link>
		<comments>http://blog.flexuous.com/2010/10/31/fujitsu-tablet-button-issue-on-windows-7-x64/#comments</comments>
		<pubDate>Sun, 31 Oct 2010 06:21:09 +0000</pubDate>
		<dc:creator>justinohms</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://blog.flexuous.com/?p=157</guid>
		<description><![CDATA[So I&#8217;ve been having strange issues with my Fujitsu tablet.   The buttons on the bezel stopped working for no apparent reason. (but I now suspect was due to a system update) I started getting the following error when I would &#8230; <a href="http://blog.flexuous.com/2010/10/31/fujitsu-tablet-button-issue-on-windows-7-x64/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=157&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been having strange issues with my Fujitsu tablet.   The buttons on the bezel stopped working for no apparent reason. (but I now suspect was due to a system update) I started getting the following error when I would try to rotate the screen with the rotate button.</p>
<p><strong>&#8220;SetSlate returned error. FjSetSlt is exiting&#8221;</strong></p>
<p>After some looking around at  <a title="tabletpcreview.com" href="http://forum.tabletpcreview.com/fujitsu/10517-setslate-returned-error-fjsetslt-exiting.html" target="_blank">tabletpcreview.com</a> and some trial and error I found a solution.</p>
<p><span id="more-157"></span>Originally I tried the procedures outlined by a number of people to uninstall the button utility, reboot, uninstall driver, reboot, delete the buttons directory under the program files/fujitsu directory, reboot then reinstall the driver, reboot, reinstall the utility&#8230;..</p>
<p>unfortunately this didn&#8217;t work.</p>
<p>However, I noticed that during the installation process, Windows7 as usual would ask the typical UAC question&#8230; &#8220;This program is attempting to make changes to the system&#8230;. &#8220;  (or whatever it normally says) and the install program opened a couple of command windows.  These windows would then generate a couple of errors.  This got me to thinking about some issues I was having with some other software on my new development machine at work&#8230; and I had an idea&#8230;&#8230;</p>
<p><strong><em>I turned off User Access Control and rebooted.</em></strong></p>
<p>now&#8230; with UAC turned off I followed the directions..</p>
<ul>
<li>Uninstall the button utility</li>
<li>Reboot</li>
<li>Uninstall the button drivers</li>
<li>Reboot</li>
<li>Re-install the button drivers</li>
<li>Reboot</li>
<li>Re-install the button utility</li>
<li>Reboot</li>
</ul>
<p>&#8230;.. it worked!   The buttons started to work&#8230;&#8230;</p>
<p>I suspect that because UAC was enabled (even though I gave permission to the installation program) the command files that it used did NOT have elevated (admin) permissions and therefore failed to perform whatever actions they were supposed to carry out.   (hence the error messages)</p>
<p>Now the next thing I need to try is to see if this idea might help me fix the blue-tooth problem I was having a couple months ago  (which again happened after an system update)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexuous.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexuous.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexuous.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexuous.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexuous.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexuous.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexuous.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexuous.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexuous.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexuous.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexuous.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexuous.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexuous.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexuous.wordpress.com/157/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=157&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.flexuous.com/2010/10/31/fujitsu-tablet-button-issue-on-windows-7-x64/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/265f8fef23f99b7192248b37c2c584ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">justinohms</media:title>
		</media:content>
	</item>
		<item>
		<title>Flex/Flash Builder localization configuration</title>
		<link>http://blog.flexuous.com/2010/09/08/flexflash-builder-localization-configuration/</link>
		<comments>http://blog.flexuous.com/2010/09/08/flexflash-builder-localization-configuration/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 22:14:19 +0000</pubDate>
		<dc:creator>justinohms</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.flexuous.com/?p=141</guid>
		<description><![CDATA[In addition to the localization strings that you can add, the underlying Flex framework needs to be localized in order to format numbers, dates, currency etc.    (think of the days of the week on a calendar control, or the &#8230; <a href="http://blog.flexuous.com/2010/09/08/flexflash-builder-localization-configuration/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=141&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In addition to the localization strings that you can add, the underlying Flex framework needs to be localized in order to format numbers, dates, currency etc.    (think of the days of the week on a calendar control, or the decimal separator for currency)</p>
<p>Adobe makes available but does not include by default many framework localization resource bundles in the form of collections of property files. These files provide localization settings for the Flex framework components including; number and currency formats, month and day names, internal error messages etc&#8230;</p>
<p>To localize the framework components it is necessary to download these property files and recompile the framework resource bundle library (framework_rb.swc) for each locale. (see attachment)  These libraries can then be compiled into our localization files.</p>
<h4>Setting up basic standard localization for the Flex environment.</h4>
<p>This post does not cover how to apply localization to your application when I have a chance I&#8217;ll post one on how to do that. Also, this information is made regarding the Flex SDK 3.4 but should apply with minor modifications to most other versions of the SDK.  These steps should apply to the command line or any version of Flex/Flash Builder with minor variation.</p>
<p>For reference, I am using Flash Builder 4 installed in the default install directory, with the 3.4.0.9271 SDK loaded as an alternative SDK.<br />
The process to setup basic Flex localization can be broken into the following steps.</p>
<ol>
<li> Create the localization component libraries in the SDK</li>
<li> Localize the component librariesfor the SDK</li>
<li> Recompile the component libraries for the SDK</li>
</ol>
<p><span id="more-141"></span><br />
Before you can localize you must set up the localization component libraries in the SDK.  By default only en_US is installed.  To install the others follow the following steps.</p>
<h3>1.	Create the localization component libraries in the SDK.</h3>
<p>To do this you must first copy the en_US stub to your new localization.  There are several standard localization names most take the form of <em>two letter language code + underscore + two letter country code</em>.  However there is no rule that you must follow this convention. Adobe includes a utility to make a copy of localizations.   You must navigate to  your SDK bin directory via the command line.    Since I am using Flash Builder 4 with the  additional SDK loaded in it, that means this directory for me is:</p>
<pre> C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\3.4.0.9271\bin\</pre>
<p>You then want to run the program <strong><span style="color:#800080;">copylocale </span></strong>(if you need to find your bin directory you can do a file search for <span style="color:#800080;">copylocale.exe</span>)</p>
<p>This is a very simple program it takes two arguments <em><strong>source</strong></em> and <strong><em>destination</em></strong> locales.  You don’t worry about directories, it knows where to do it’s business.    I will be creating a generic Spanish locale (<span style="color:#800080;"><strong>es</strong></span>) and a Mexico specific locale (<span style="color:#800080;"><strong>es_MX</strong></span>).  So I will run the following two commands.</p>
<pre>copylocale en_US es
copylocale en_US es_MX</pre>
<p>These commands will do a number of things but basically they copy:</p>
<pre> C:\...\Adobe Flash Builder 4\sdks\3.4.0.9271\frameworks\projects\framework\bundles\en_US\</pre>
<p>To:</p>
<pre> C:\...\Adobe Flash Builder 4\sdks\3.4.0.9271\frameworks\projects\framework\bundles\es\
 C:\...\Adobe Flash Builder 4\sdks\3.4.0.9271\frameworks\projects\framework\bundles\es_MX\</pre>
<p>And at the same time they compile the contents of those directories to several swc files located in:</p>
<pre> C:\...\Adobe Flash Builder 4\sdks\3.4.0.9271\frameworks\locale\es\
 C:\...\Adobe Flash Builder 4\sdks\3.4.0.9271\frameworks\locale\es_MX\</pre>
<h3>2.	Localize the component libraries for the SDK</h3>
<p>Now you need to modify the source files located in the first set of directories</p>
<pre> C:\...\Adobe Flash Builder 4\sdks\3.4.0.9271\frameworks\projects\framework\bundles\es\
 C:\...\Adobe Flash Builder 4\sdks\3.4.0.9271\frameworks\projects\framework\bundles\es_MX\</pre>
<p>You can modify these by hand if you want to and happen to have the knowledge.  But there is an easier way.</p>
<p>Adobe has made available a set of basic localization files for over a dozen languages online.  (Why they just don&#8217;t just include these… I don’t understand)  You can download the files at:</p>
<p><a href="http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/frameworks/projects/framework/bundles/" target="_blank">http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/frameworks/projects/framework/bundles/</a></p>
<p>For my purpose I will get the<strong> es_ES</strong> directory and copy all of the <span style="color:#800080;"><strong>*.property</strong></span> files to the two directories above.  I will make a further change to a few of the files I copy into the <strong>es_MX</strong> directory, but other than that, that is it.</p>
<p style="padding-left:30px;"><em> Note: There is a “docs/” directory in the resource directories on the download site.  I don’t think you need it unless you want to localize the context help for your installation of Flex/Flash Builder.</em></p>
<h3>3.	Recompile the component libraries for the SDK</h3>
<p>You are not quite done yet.  If you were to attempt to localize an application at this time you would find that everything is still using en_US.   (&#8216;January&#8217; &#8216;Monday&#8217;,$, etc..)  The reason is that when flex compiles your application,  it uses the SWC files located in these directories:</p>
<pre>C:\...\Adobe Flash Builder 4\sdks\3.4.0.9271\frameworks\locale\es\
C:\...\Adobe Flash Builder 4\sdks\3.4.0.9271\frameworks\locale\es_MX\</pre>
<p>These were created in step 1, before you downloaded the localized files from Adobe.  To recompile these files I use the following command, but first I must change my command console directory to the root of the sdk.  In my case that is:</p>
<pre>C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\3.4.0.9271</pre>
<p style="padding-left:30px;"><em>(Note: the next commands are all on one line. I broke it out so you could read it easier.  I also boldfaced the command line options.)</em></p>
<p>Now I run the following command</p>
<p><code> <strong><span style="color:#0000ff;"> bin\compc</span></strong><strong> -locale</strong>=es<br />
<strong> -source-path</strong>+=<br />
frameworks/projects/framework/bundles/es/src/<br />
<strong> -include-resource-bundles</strong>=<br />
collections,containers,controls,core,effects,formatters,logging,SharedRe<br />
sources,skins,states,styles<br />
<strong> -output</strong>=frameworks/locale/es/framework_rb.swc<br />
</code></p>
<p style="padding-left:30px;">I run it again for Mexico variant</p>
<p><code><br />
<strong><span style="color:#0000ff;">bin\comp</span><span style="color:#0000ff;">c</span><span style="color:#0000ff;"> </span>-locale</strong>=es_MX<br />
<strong>-source-path</strong>+=<br />
frameworks/projects/framework/bundles/es_MX/src/<br />
<strong>-include-resource-bundles</strong>=<br />
collections,containers,controls,core,<br />
effects,formatters,logging,SharedResources,skins,states,styles<br />
<strong>-output</strong>=frameworks/locale/es_MX/framework_rb.swc</code></p>
<p>These last two commands compile the property files into the <strong><span style="color:#993366;">framework_rb.swc</span></strong> file.  This library is then in turn used by the compiler when you compile your application or can be dynamically loaded as a localization into your app.</p>
<p>Now you are set to localize your project swf or compile dynamic locale swf files with all of the base flex components being localized.    (&#8216;Enero&#8217; &#8216;de lunes&#8217;, peso, euro etc..)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexuous.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexuous.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexuous.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexuous.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexuous.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexuous.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexuous.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexuous.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexuous.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexuous.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexuous.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexuous.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexuous.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexuous.wordpress.com/141/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=141&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.flexuous.com/2010/09/08/flexflash-builder-localization-configuration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/265f8fef23f99b7192248b37c2c584ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">justinohms</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting Flex UI components all the same width or height</title>
		<link>http://blog.flexuous.com/2010/08/18/getting-flex-ui-components-all-the-same-width-or-height/</link>
		<comments>http://blog.flexuous.com/2010/08/18/getting-flex-ui-components-all-the-same-width-or-height/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 17:01:09 +0000</pubDate>
		<dc:creator>justinohms</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[AIR (Adobe Integrated Runtime)]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[mxml]]></category>

		<guid isPermaLink="false">http://blog.flexuous.com/?p=128</guid>
		<description><![CDATA[You need some way of telling all of the components in the set to re-size to the largest size of any of the components.   <a href="http://blog.flexuous.com/2010/08/18/getting-flex-ui-components-all-the-same-width-or-height/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=128&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a lot of work using localization lately and as part of this I&#8217;ve had to consider the fact that words in one language are not usually the same lengths as their translations in another.  Because of this I&#8217;ve increasingly been relying on the size to fit content ability of labels, buttons etc. in side of Flex.   Now that is all well and good except for when you want a set of buttons to all be the same width or some labels and controls to all line up and be the same width.    You need some way of telling all of the components in the set to re-size to the largest size of any of the components.  I&#8217;ve written a very little function to do just that.<span id="more-128"></span>This function works on any component with a width property (It&#8217;s intended for UI components)  here is the code:</p>
<p><pre class="brush: plain;">
/** Takes a series of UI components, sets all widths to the widest width */
private function setToGreatestWidth(...args):void{
   args.sortOn(['width'], Array.NUMERIC | Array.DESCENDING);
   for(var i:uint = 0; i &lt; args.length; i++) {
        args[i].width = args[0].width;
   }
}
</pre></p>
<p>I would typically call it like this in the on creation complete handler for my UI container:</p>
<p><pre class="brush: plain;">
private function onCreationComplete():void{
   setToGreatestWidth(this.button_upload,this.button_cancel);
   setToGreatestWidth(this.label1,this.label2,this.label3,this.label4);
}
</pre></p>
<p>By calling it from the creation complete handler you ensure that all localization strings have loaded and layout has already occurred and therefore the controls have all adjusted to their content width.</p>
<p>(I&#8217;m not sure there may be  a really cool and efficient way to accomplish this in the new Spark architecture but I&#8217;m working on some older 3.4 code so I don&#8217;t have access to those components anyway.)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexuous.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexuous.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexuous.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexuous.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/flexuous.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/flexuous.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/flexuous.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/flexuous.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexuous.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexuous.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexuous.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexuous.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexuous.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexuous.wordpress.com/128/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.flexuous.com&amp;blog=3072563&amp;post=128&amp;subd=flexuous&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.flexuous.com/2010/08/18/getting-flex-ui-components-all-the-same-width-or-height/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/265f8fef23f99b7192248b37c2c584ac?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">justinohms</media:title>
		</media:content>
	</item>
	</channel>
</rss>
