<?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>dispatchEvent()™ &#187; Tips, Tricks, and Hacks</title>
	<atom:link href="http://dispatchevent.org/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://dispatchevent.org</link>
	<description>Collective thoughts on the Flash Platform, iOS, Unity, and any other technology we use.</description>
	<lastBuildDate>Mon, 23 Apr 2012 19:07:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Why there are no million dollar ideas</title>
		<link>http://dispatchevent.org/mims/why-there-are-no-million-dollar-ideas/</link>
		<comments>http://dispatchevent.org/mims/why-there-are-no-million-dollar-ideas/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 23:02:24 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[IRL]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[collaboration]]></category>
		<category><![CDATA[ideas]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=897</guid>
		<description><![CDATA[It is well known among my friends that I &#8220;do something to computers that somehow makes apps exist.&#8221; As such, I am often approached with the inevitable proposition that goes something like this: &#8220;I&#8217;ve got a million dollar idea for an app and when you build it we&#8217;ll be rich.&#8221; These pitches typically make use [...]]]></description>
			<content:encoded><![CDATA[<p>It is well known among my friends that I &#8220;do something to computers that somehow makes apps exist.&#8221;  As such, I am often approached with the inevitable proposition that goes something like this: &#8220;I&#8217;ve got a million dollar idea for an app and when you build it we&#8217;ll be rich.&#8221; These pitches typically make use of the pronoun &#8220;we,&#8221; as in &#8220;we can charge 50Â¢ per penguin,&#8221; and a pre-meditated revenue split, as in &#8220;you can keep 50% of the penguin monies.&#8221; This is the modern version of the old favorite, &#8220;can you make me a website,&#8221; <em>for free</em> implied.</p>
<p>Some of these ideas are great, many are not. But regardless of their quality, I want to try to reset the expectations of the idea generators. I hope this post sheds some light on the legal, social and practical implications of these ideas and provides some ground rules that will help bring these ideas into fruition.</p>
<p>(Read the full article after the jump)</p>
<p><span id="more-897"></span></p>
<h2 id="first_of_all">First of all</h2>
<p>If your idea includes the words &#8220;like [a social network] but better&#8221; stop right there. I had an idea for a car that&#8217;s like a Ferrari but it&#8217;s twice as fast gets 1,000 miles per gallon! Fuck you.</p>
<h2 id="the_value_of_your_idea">The value of your idea</h2>
<p>Great achievements come from great ideas. Most of the time, however, people are all too willing to start planning their retirement before the thought of a business plan ever crosses their minds. Making an app can cost  a lot of time and money and there&#8217;s lots of competition. Most don&#8217;t sell well after their first month. While it&#8217;s true that you can make a million, it doesn&#8217;t happen every day. </p>
<p>In reality, your idea is probably worth a great deal less than $1,000,000. In fact, it&#8217;s probably worth very close to $0. Why? For one thing, can you even reasonably define what an idea is? For example, If you have a $1M idea but I have an idea that makes your better, how much is mine worth? What if 5 other people had that idea independently? (Even <em>Calculus</em> was discovered by at least two mathematicians working separately and they drew from centuries of previous concepts.) So the answer is simply this: ideas (even good ones) are worth nothing until they&#8217;re turned into something. </p>
<p>The good news, how ideas are implemented is at least as important as the intial idea. Google didn&#8217;t invent the search engine, they just made it better. That means that you don&#8217;t even need a new idea to make a million (or <a href="http://www.google.com/finance?client=ob&amp;q=NASDAQ:GOOG">189 billion</a>)!  There&#8217;s always room for improvement. The App Store is full of garbage apps that could be made better.</p>
<h2 id="release_early_release_often">Release early, Release often</h2>
<p>If you&#8217;ve had an idea, great! Me too. Keep having them. Have as many as you can. Write them all down. Take the best ones and <em>make them!</em> </p>
<p>Any photographer will tell you that for every 100 photos you take you&#8217;ll be lucky if you get one good one. Ideas are the same way. I have a long list of ideas for apps, games, products, etc. that I maintain and regularly review. A couple are (I think) really good. Some are good but would require a huge amount of work to execute. Most of them, over time, seem so stupid as to make me wonder what the hell I was thinking.  The important thing is that I have lots and lots of them and I recognize that they all need work. </p>
<p>To continue with the analogy of photographs, if you leave them as negatives or let them just sit on your camera card, you might as well not have bothered. Ideas are the same way. They need to be developed into something tangible to be worth anything. </p>
<h2 id="who_owns_your_idea">Who owns your idea?</h2>
<p>If you think your idea is something you own that people want to take, you&#8217;ve got it backwards. You don&#8217;t own the idea and people are free to take it but they don&#8217;t want to. </p>
<p>Now I&#8217;m not a lawyer (and this is not intended as legal advice) but if I&#8217;m not mistaken, unless you have made an agreement to the contrary, an idea alone cannot be copyrighted or trademarked. These protections are reserved for &#8220;things&#8221; that exist in the world. Even a unique concept carefully described in writing is little evidence when faced with a solid, working app. Think about it. If it were not true wouldn&#8217;t that mean science fiction writers could sue technology companies for stealing their ideas for robots, spaceships, etc.</p>
<p>Does that mean you shouldn&#8217;t tell anyone? Not necessarily. In reality, most people are not interested in stealing your idea and if they are, they still have to make something out of it. I can&#8217;t think of anyone who&#8217;s got the talent and capital and drive to build something great who is just waiting around for someone to slip up and hand him a genius idea. So you&#8217;re probably safe to talk about it. In fact, you&#8217;ll probably find it helpful to get other&#8217;s input.</p>
<p>If the idea of sharing still makes you nervous you can always use a non-disclosure agreement. You can find many examples online.</p>
<h2 id="the_right_way_to_do_it">The right way to do it</h2>
<p>Despite everything I&#8217;ve said, I don&#8217;t want people to stop contacting me with their ideas. I just want to set the level of expectation back to a reasonable level. Here&#8217;s a checklist for you potential idea-havers:</p>
<ul>
<li><strong>Lower your expectations.</strong> This is the crux of the whole article. Put the concept of the million dollar idea out of your head and think about how to build a million dollar company. </li>
<li><strong>Develop your idea.</strong> Take your idea and make it better. Find out who your competitors are. Spend some time researching, designing, polishing. In other words, turn your idea into a plan that you can use to build. </li>
<li><strong>Make yourself useful.</strong> If you think you deserve 50%, you better be ready to do 50% of the work. That means writing business plans, fundraising, designing the interface, hiring a team, or doing whatever it is you can to make it happen.</li>
<li><strong>Respect other people&#8217;s professions.</strong>Building an app or website is hard. It can take months or years of man-hours. You wouldn&#8217;t expect a carpenter friend to say yes to building a new restaurant in exchange for 50% of the sales. But he might if you had blueprints, a star chef, and $500,000! See the difference?</li>
<li><strong>Don&#8217;t stop sharing your idea</strong>  Ask for feedback. Try not to take it personally if you don&#8217;t like what you hear.</li>
</ul>
<p>The last thing I have to say is a note to myself: Take your own advice. Stop talking about it and go make some $1,000,000 apps and things!</p>
<h3 id="ps">P.S.</h3>
<p>During the writing of this article, I was trying to do some research into the copyrights of ideas themselves and found a couple of great articles on the same topic by <a href="http://blog.pekpongpaet.com">Pek Pongpet</a> so apparently I&#8217;m not alone. </p>
<p><a href="http://blog.pekpongpaet.com/2010/11/04/the-myth-of-people-stealing-your-ideas/">The myth of people stealing your ideas</a></p>
<p><a href="http://blog.pekpongpaet.com/2010/04/01/ive-got-this-great-idea-if-you-only-build-it/">I&#8217;ve got this great idea if you only build it</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/why-there-are-no-million-dollar-ideas/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Enabling the Flash Debug Player on Chrome</title>
		<link>http://dispatchevent.org/mims/enabling-the-flash-debug-player-on-chrome/</link>
		<comments>http://dispatchevent.org/mims/enabling-the-flash-debug-player-on-chrome/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 09:05:27 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[debugger]]></category>
		<category><![CDATA[plug-in]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=892</guid>
		<description><![CDATA[After having this happen to me for the third time, I felt that it was time for me to repost this information. The problem: You&#8217;re positive that you just upgraded to the Debug version of the Flash Player, when you go to test it in Chrome it says that you don&#8217;t have the debug version [...]]]></description>
			<content:encoded><![CDATA[<p>After having this happen to me for the third time, I felt that it was time for me to repost this information. </p>
<h3>The problem:</h3>
<p>You&#8217;re positive that you just upgraded to the Debug version of the Flash Player, when you <a href="http://kb2.adobe.com/cps/155/tn_15507.html">go to test it</a> in Chrome it says that you don&#8217;t have the debug version even though it works fine in Firefox, Safari, Opera, and who cares if it&#8217;s working in IE because you would never use IE right?</p>
<h3>The solution:</h3>
<p>You can reinstall the player until you&#8217;re blue in the face but it won&#8217;t help. Why? Chrome manages it&#8217;s own version copy of the player so it can provide automatic updates. You&#8217;ll want to disable this version and use your default one. </p>
<p>Open up your Preferences in Chrome. Go to <i>Preferences > Under the Hood > Privacy > Content Settings&#8230; > Plug-ins > Disable Individual Plugins</i> (Or just paste <a href="chrome://plugins/">chrome://plugins/</a> into the address bar). </p>
<p>You should see a plug in called Flash. If you click the Details+ button in the top right, you&#8217;ll see more info about the plug-in files themselves. You&#8217;ll probably see two versions here; one will point to the plug-in installed by Chrome </p>
<p>e.g. <i>/Applications/Google Chrome.app/Contents/Versions/15.0.874.92/Google Chrome Framework.framework/Internet Plug-Ins/Flash Player Plugin for Chrome.plugin</i></p>
<p>The other points to the system folder</p>
<p>e.g. <i>/Library/Internet Plug-Ins/Flash Player.plugin</i> if you&#8217;re on a Mac</p>
<p><strong>Disable the one in the Google Chrome folder</strong> and you should be good to go!</p>
<p>This information was originally provided to me via <a href="http://www.aaronwest.net/blog/index.cfm/2010/4/27/Configuring-Chrome-with-Flash-Player-Debugger">Arron West&#8217;s blog</a> which has more pictures than this post if you still need help. </p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/enabling-the-flash-debug-player-on-chrome/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Snippet Saturday: quick random choice</title>
		<link>http://dispatchevent.org/mims/snippet-saturday-quick-random-choice/</link>
		<comments>http://dispatchevent.org/mims/snippet-saturday-quick-random-choice/#comments</comments>
		<pubDate>Sun, 20 Mar 2011 20:05:22 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=877</guid>
		<description><![CDATA[Today&#8217;s Snippet Saturday (actually, Sunday) is a quick shortcut for choosing one of several strings, objects, etc. randomly. Now, I wouldn&#8217;t really recommend using this code in a project. There are ways to do the same thing that are much more readable and less error prone. Instead, I thought it was an interesting experiment to [...]]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s Snippet Saturday (actually, Sunday) is a quick shortcut for choosing one of several strings, objects, etc. randomly. </p>
<p><script src="https://gist.github.com/878605.js?file=randomChoice.as"></script></p>
<p>Now, I wouldn&#8217;t really recommend using this code in a project. There are ways to do the same thing that are much more readable and less error prone. Instead, I thought it was an interesting experiment to show off some of how AS3&#8242;s syntax works for those of you who may not have seen something like this. </p>
<p>What&#8217;s happening here? Let&#8217;s break it down.</p>
<ul>
<li><code>["Alpha", "Bravo", "Charlie"]</code> &#8211; Here we are instantiating a new array and populating it with three strings. This is essentially the same as:
<pre>
var a:Array = new Array();
a[0] = "Alpha";
a[1] = "Bravo";
a[2] = "Charlie";
</pre>
</li>
<li><code>[...]</code> &#8211; next is another pair of square brackets. This is an <a href="http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/operators.html#array_access">array access operator</a>. In other words, everything between the two brackets will be evaluated as the index of the array to retrieve.</li>
<li><code>int(..</code>.) &#8211; This is an <a href="http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&#038;file=00000048.html">explicit type-cast to an int</a>. That means that everything inside those parentheses is evaluated and flash attempts to convert from whatever data type it is to an integer. In the case of decimal numbers, they are rounded down so this is similar to using <code>Math.floor()</code>.</li>
<li><code>Math.random() * 3</code> &#8211; random() of course produces a random floating point (decimal) number between 0.0 and (almost but not quite) 1.0. Multiplying that number by 3 (the length of the array) produces a number between 0.0 and 3.0 (technically, between 0 and 2.99999999etc).</li>
</ul>
<p>The result, an array is created with three strings, a random number between 0.0 and (almost) 3.0 is generated, it is rounded down to an int between 0 and 2, that number is used as the index of the array to look up. The result will be randomly one of the three strings. </p>
<p>I hope you found this interesting!</p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/snippet-saturday-quick-random-choice/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Matryoshka Functions</title>
		<link>http://dispatchevent.org/mims/matryoshka-functions/</link>
		<comments>http://dispatchevent.org/mims/matryoshka-functions/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 19:22:40 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=869</guid>
		<description><![CDATA[The other day, I was working with the Flex function BindingUtil.bindProperty(). I always have a hard time remembering which pair of arguments comes first, the &#8216;site&#8217; or the &#8216;host&#8217; and to be honest, the names don&#8217;t really make much sense to me. &#8220;Oh, if only this were an Objective-C project I would have to laboriously [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dispatchevent.org/wp-content/uploads/2011/01/First-matryoshka-museum-doll-open.jpeg"><img src="http://dispatchevent.org/wp-content/uploads/2011/01/First-matryoshka-museum-doll-open-300x211.jpg" alt="" width="300" height="211" class="alignnone size-medium wp-image-870" /></a><br />
The other day, I was working with the Flex function BindingUtil.bindProperty(). I always have a hard time remembering which pair of arguments comes first, the &#8216;site&#8217; or the &#8216;host&#8217; and to be honest, the names don&#8217;t really make much sense to me. &#8220;Oh, if only this were an Objective-C project I would have to laboriously type out each name of each parameter.&#8221; I thought, &#8220;It would be so much more obvious if it were writen like <code>Bind.property("foo").fromObject(bar).toTheValueOfProperty("foo").ofObject(baz);</code>.&#8221; </p>
<p>What followed was the discovery/invention of just such a thing, a nested, super-verbose function. The function achieves this by returning an instance of an internal class with nothing in it except for the next step in the chain.</p>
<pre lang="actionscript3">
package
{
	public class Bind
	{
		public static function updateProperty(object:Object, property:String):BindSource {
			return new BindSource(object, property);
		}
	}
}
import mx.binding.utils.BindingUtils;
class BindSource {

	private var targetObject:Object;
	private var targetProperty:String;

	public function BindSource(targetObject:Object, targetProperty:String):void {
		this.targetObject = targetObject;
		this.targetProperty = targetProperty;
	} 

	public function whenSourcePropertyChanges(object:Object, property:String):void {
		BindingUtils.bindProperty(targetObject, targetProperty, object, property);
	}
}
</pre>
<p>To call this function you would use:</p>
<pre lang="actionscript3">Bind.updateProperty(foo, "bar").whenSourcePropertyChanges(baz, "bar");</pre>
<p>Kinda cool! I soon realized that this technique has some characteristics that Objective-C messages don&#8217;t have. For example, each step can use more than one parameter (plus they each get their own code hinting). You can also provide multiple choices for what to do next providing a sort of branching behavior.</p>
<pre lang="actionscript3">
AngleFinder.getAngleOfVector(4, 4).inDegrees() 	// 45Â°
AngleFinder.getAngleOfVector(4, 4).inRadians() 	// Ï€/4
</pre>
<p>You can even do free-form stacking of functions like this.</p>
<pre lang="actionscript3">
new Calculator	(5)                    // 5
                        .plus(3)            // 8
                        .times(2)          // 16
                        .dividedBy(4)   // 4
                        .minus(1)         // 3
                        .plus(2)            // 5
                        .equals();
</pre>
<p>I proudly named these &#8220;Matryoshka Functions&#8221; after the Russian stacking dolls even though I&#8217;m sure I&#8217;m not the first to try something like this. As it turns out, they&#8217;re about 10% practical and 90% clever hack. Even though there could be some potential use for this (especially with complicated, repetitive tasks), this technique conflicts too much with the way we normally code in ActionScript. Still, I thought it was cool enough to share with everyone.</p>
<p>Pros:</p>
<ul>
<li>Very descriptive</li>
<li>Branching and stacking effect is interesting and potentially useful</li>
<li>Code hinting shows the next step in the function as well as the parameter names</li>
<li>Looks cool!</li>
</ul>
<p>Cons:</p>
<ul>
<li>Abominable code style. Too weird to be useful.</li>
<li>Difficult to know when to stop calling functions</li>
<li>Not completing the function will produce unexpected results with no compile-time errors</li>
<li>Each step requires you to pass the parameters from the previous step</li>
</ul>
<p>Can you find any use of these? Can you think of a more efficient way to write the functions? Any other thoughts?</p>
<p>Check out the source with multiple examples (FlashBuilder project).<br />
<a href='http://dispatchevent.org/wp-content/uploads/2011/01/MatroshkaFunctionDemo.zip'>MatroshkaFunctionDemo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/matryoshka-functions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Killing 3D Transforms</title>
		<link>http://dispatchevent.org/roger/killing-3d-transforms/</link>
		<comments>http://dispatchevent.org/roger/killing-3d-transforms/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 07:33:31 +0000</pubDate>
		<dc:creator>Roger Braunstein</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=848</guid>
		<description><![CDATA[Here&#8217;s a quick tip. If you&#8217;ve ever dealt with 3D in Flash Player 10+ you&#8217;ll know that DisplayObjects in 3D in Flash Player are bitmap-cached; only the bitmap representation is transformed in 3D. Recently I was working on a site where objects landed on the stage, but after landing, they appeared really muddy, which was [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick tip. If you&#8217;ve ever dealt with 3D in Flash Player 10+ you&#8217;ll know that DisplayObjects in 3D in Flash Player are bitmap-cached; only the bitmap representation is transformed in 3D. Recently I was working on a site where objects landed on the stage, but after landing, they appeared really muddy, which was obvious when you looked at the text they contained. Even though they were completely flat, they were still using bitmap proxies! Not great.</p>
<p>Turning a DisplayObject into a 3D DisplayObject is as simple as assigning a value to its rotationX, rotationY, rotationZ, or z properties. But how do you turn it back? I tried giving all these properties a value of 0, but after their animations completed they were already 0. An object at z=0 still renders in 3D, using bitmap caching. Setting these values to NaN was no better.</p>
<p>The solution I found is to null out the 3D transformation matrix and assign a 2D transformation matrix. This can be accomplished like so for a DisplayObject named <code>sprite</code>:</p>
<p><code>var matrix:Matrix = new Matrix();<br />
matrix.translate(sprite.x, sprite.y);<br />
matrix.rotate(sprite.rotationZ);<br />
sprite.transform.matrix3D = null;<br />
sprite.transform.matrix = matrix;</code></p>
<p>In this code I simply drop the transformations that are inapplicable to 2D space. This is fine when your object is already coplanar with the stage.</p>
<p>Anyway, quick tip if this ever had you scratching your head too.</p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/roger/killing-3d-transforms/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IDisplayObject? &#8211; Getting around the lack of an interface for the DisplayObject in Flash</title>
		<link>http://dispatchevent.org/mims/idisplayobject/</link>
		<comments>http://dispatchevent.org/mims/idisplayobject/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 02:27:22 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[displayobject]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[idisplayobject]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=838</guid>
		<description><![CDATA[Interfaces are amazing things. When I was young and green, I didn&#8217;t understand their purpose, but after working with them for a while, I will defend their use to the end. I try to create lots of interfaces early on in my projects and I find that by keeping things flexible, it saves more time [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dispatchevent.org/wp-content/uploads/2010/03/DisplayObject_subclasses.png"><img class="alignnone size-medium wp-image-840" title="DisplayObject_subclasses" src="http://dispatchevent.org/wp-content/uploads/2010/03/DisplayObject_subclasses-300x156.png" alt="" width="300" height="156" /></a></p>
<p>Interfaces are amazing things.  When I was young and green, I didn&#8217;t understand their purpose, but after working with them for a while, I will defend their use to the end. I try to create lots of interfaces early on in my projects and I find that by keeping things flexible, it saves more time despite the extra typing, pardon the double entendre.</p>
<p>But this is not an article about why interfaces are so great. No, this is an article about the mysterious gap in the Flash Player API with regards to an interface for DisplayObjects. If you have a class typed as something like <code>IView</code>, there&#8217;s no way to enure that <code>IView</code> can be a parameter of display list functions like <code> addChild()</code>.</p>
<p><span id="more-838"></span>Why can&#8217;t we guarantee that something is a DisplayObject through interfaces?Â There is a practical answer. The inner workings of the Flash Player are slowing unfolding to us with each version. We now have low level access to sound, byte streams, and text rendering. However, the display list still relies exclusively on one of the only truly abstract classes in ActionScript 3.0, the DisplayObject. Because a low-level drawing engine is not exposed to AS3 programmers, we don&#8217;t know how it works and we cannot guarantee through an interface that an arbitrary class can be drawn.</p>
<p>Fortunately, there are some workarounds that can help, each with their own strengths and weaknesses. Personally, I think #2 is the way to go. It&#8217;s practically dripping with polymorphic goodness.</p>
<ol>
<li>
<h3>Make your interface inherit from IBitmapDrawable and IEventDispatcher</h3>
<p>DisplayObject is the only class that uses both of these two interfaces so by combining them in your interface, you can sort of be sure you&#8217;re working with a DisplayObject. Still, this is my least favorite solution</p>
<h4>Pros:</h4>
<ul>
<li>Uses interfaces exclusively.</li>
<li>Only a DisplayObject would implement both of these.</li>
</ul>
<h4>Cons:</h4>
<ul>
<li>There&#8217;s nothing to stop you from using this to create a class that isn&#8217;t a DisplayObject and that could cause problems.</li>
<li>You would still have to type cast to DisplayObject to use this as an argument for <code>addChild()</code>.</li>
</ul>
</li>
<li>
<h3>Create an interface that exposes a method to return the object as a DisplayObject</h3>
<p>My personal favorite solution. It not only solves the problem of guaranteeing that a class can go in the display list, it doesn&#8217;t even require that the class be a DisplayObject.</p>
<p>Here&#8217;s an example of what this would look like. <a href="http://gist.github.com/332408">IDisplayObject.as</a></p>
<h4>Pros:</h4>
<ul>
<li>Flexible solution that conforms to good OOD principles.</li>
<li>Uses interfaces exclusively.</li>
<li>Easy to apply. You can usually implement it with a single line of code: <code>return this;</code></li>
</ul>
<h4>Cons:</h4>
<ul>
<li>Requires you to use <code>asDisplayObject()</code> every time you want to use the object as a DisplayObject.</li>
<li>Calling <code>foo.asDisplayObject()</code> would throw an exception if <code>foo</code> was null so additional checks may be necessary.</li>
</ul>
</li>
<li>
<h3>Use an <a href="http://en.wikipedia.org/wiki/Abstract_type">abstract class</a> that inherits from DisplayObject</h3>
<p>Not an ideal solution primarily because Flash doesn&#8217;t have true abstract classes (although <a href="http://dispatchevent.org/mims/abstract-classes-in-as3/">there are workarounds</a>) but still totally valid.</p>
<h4>Pros:</h4>
<ul>
<li>Guarantees that the object is a DisplayObject. No type casting required.</li>
<li>Abstract classes can be treated virtually the same as an interface for practical use.</li>
</ul>
<h4>Cons:</h4>
<ul>
<li>No true abstract classes in Flash.</li>
<li>Not as flexible as an interface-based solution since it forces you to inherit from DisplayObject.</li>
</ul>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/idisplayobject/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>The art of the conference</title>
		<link>http://dispatchevent.org/mims/the-art-of-the-conference/</link>
		<comments>http://dispatchevent.org/mims/the-art-of-the-conference/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 01:33:19 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Conferences and User Groups]]></category>
		<category><![CDATA[Greatest Hits]]></category>
		<category><![CDATA[IRL]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[gdc]]></category>
		<category><![CDATA[lifeskills]]></category>
		<category><![CDATA[social]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=832</guid>
		<description><![CDATA[I&#8217;ve just wrapped up my third GDC conference. I learned loads from it and feel incredibly rejuvenated creatively! But before I talk about what I learned there, I wanted to take a moment to share some helpful guiding principles for attending conferences. Here&#8217;s sort of a top ten list of tips for making the most [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just wrapped up my third <a href="http://gdconf.com">GDC</a> conference. I learned loads from it and feel incredibly rejuvenated creatively! But before I talk about what I learned there, I wanted to take a moment to share some helpful guiding principles for attending conferences. Here&#8217;s sort of a top ten list of tips for making the most of it.</p>
<p>By the way, even though I attend conferences for programmers, I believe these guidelines are good for any conference attendee.</p>
<p><a href="http://dispatchevent.org/wp-content/uploads/2010/03/GDC-Crowd.jpg"><img src="http://dispatchevent.org/wp-content/uploads/2010/03/GDC-Crowd-300x144.jpg" alt="" title="GDC-Crowd" width="300" height="144" class="alignnone size-medium wp-image-833" /></a></p>
<ol>
<li>
<h3>Talk to people</h3>
<p>When you break it down, the whole reason to go to conferences is to talk to people. The sessions are good too but I tend to find satisfaction from them only about 50% of the time.  People are why I&#8217;m there.  Don&#8217;t be surprised if people aren&#8217;t rushing up to talk to you, especially if you&#8217;re attending a conference with lots of programmers. Make an effort to approach people and start the dialogue. It doesn&#8217;t have to be fancy. You can literally walk up to a stranger and say &#8220;Hi. My name is Mims. How&#8217;s it going?&#8221; and you&#8217;re doing it.</p>
</li>
<li>
<h3>Know your story</h3>
<p>You&#8217;re going to get a lot of chances to tell people about yourself, your company, your projects, and your brand so make sure you know what you&#8217;re going to say when someone asks you. There&#8217;s a good chance that you&#8217;ll be speaking to your industry heroes which can feel very intimidating. Know your own story and be able to communicate it concisely and confidently even if in you&#8217;re head you&#8217;re thinking &#8220;I&#8217;m not worthy.&#8221; Keep it short and positive.</p>
</li>
<li>
<h3>Be interesting</h3>
<p>In other words, have good conversation skills. Of course, this is easier said than done for most people. But even YOU can be interesting with a couple of little tricks. Aside from telling <em>your</em> story, ask them about <em>their</em> story. It&#8217;s mysterious but true, asking people about themselves makes you seem more interesting! Furthermore, someone wiser than me once said that if you want to find success, ask your clients what&#8217;s keeping them up at night then tailor your service to help them solve the problem. Asking about what&#8217;s been inspiring them at the conference is good too because it&#8217;s usually something they&#8217;re excited to discuss and there&#8217;s a slim chance they&#8217;ll accidentally tell you their million dollar idea.</p>
<p>Also, don&#8217;t talk forever, just say &#8220;Hey, great meeting you. I&#8217;ll check out your stuff.&#8221; and you&#8217;re done. You don&#8217;t have to wait for an awkward silence, you can end it on a high note.</p>
</li>
<li>
<h3>Bring lots of business cards</h3>
<p>Your card reminds the people you talk to of the conversation you had with them and tells them how to find out more about you. That&#8217;s really it. You can make really flashy, expensive cards but printing them on your inkjet works just as well in my opinion. What doesn&#8217;t work is when you don&#8217;t have one. They&#8217;ll go faster than you think so bring a bunch.</p>
<p>Also, when you trade cards, you can write a note on the back of your card about the project you discussed and do the same for yourself when you receive a card from them.</p>
</li>
<li>
<h3>Not a vacation</h3>
<p>It can be tempting to get drunk every night, or blow off sessions, or even to see some sights while you&#8217;re away at a conference. I&#8217;m not saying you shouldn&#8217;t have fun and I&#8217;m definitely not saying you shouldn&#8217;t have drinks with your industry colleagues. Just remember that you (or your company) are paying a lot for you to be there and every minute is an opportunity to learn something or make a connection with a new client, employee or friend.</p>
<p><a href="http://dispatchevent.org/wp-content/uploads/2010/03/party-dog-303x365.jpg"><img src="http://dispatchevent.org/wp-content/uploads/2010/03/party-dog-303x365-249x300.jpg" alt="" title="party-dog-303x365" width="249" height="300" class="alignnone size-medium wp-image-836" /></a>
	</li>
<li>
<h3>Do some research about the speakers / topics / sponsors</h3>
<p>Obviously, it&#8217;s a good idea to review the schedule to see which sessions you may want to attend. It can also be good to do a quick background check on the companies that will be speaking. A quick visit to their website will do usually and you may discover that they did some work you really admire. Chances are, they did or they wouldn&#8217;t be speaking. If the schedule is too overwhelming, you can always bring the program home and research retroactively.</p>
</li>
<li>
<h3>If a talk is bad, it&#8217;s okay to leave</h3>
<p>Unless it would be an obvious or odious disturbance to the session, there&#8217;s no rule that says you have to sit through a boring or irrelevant session. Duck out respectfully and go into another session or just mingle in the hallway.</p>
<p><a href="http://dispatchevent.org/wp-content/uploads/2010/03/doc_looking_at_watch1.jpg"><img src="http://dispatchevent.org/wp-content/uploads/2010/03/doc_looking_at_watch1-300x225.jpg" alt="" title="doc_looking_at_watch" width="300" height="225" class="alignnone size-medium wp-image-835" /></a></p>
</li>
<li>
<h3>Attend some sessions that aren&#8217;t targeted at you</h3>
<p>I&#8217;ve found that some of the most interesting talks at conferences are ones aimed at other jobs.  It&#8217;s eye-opening to see what business-people, project managers, and programmers from other languages are talking about.</p>
</li>
<li>
<h3>Use Twitter</h3>
<p>Like it or not, at a conference, Twitter is the little bird that tells you what&#8217;s happening all around you &#8211; what talks are worth attending, what news is being announced, where the party is at, and who you need to talk to. Using and watching hashtags suddenly makes your tweets visible to people who otherwise wouldn&#8217;t see you and vice versa. I meet lots of strangers through twitter at conferences. For example, this year I had lunch with the cool dudes at <a href="http://tribalgames.mobi/">Tribal Games</a> who I met simply because they <a href="http://twitter.com/DocPop/status/10283065609">tweeted</a> &#8220;going to lunch, who wants to go?&#8221; An icon that shows your face helps too &#8211; I recognize a lot of people from their icons! Finally, if you don&#8217;t have separate accounts, try not to twitter about your personal life at the conference.</p>
</li>
<li>
<h3>Don&#8217;t waste the momentum</h3>
<p>You&#8217;re going to meet people, see new things, and be inspired on multiple fronts. When you get home, do something with all of that good energy immediately. If you just go back to your routine of clients, meetings and daily bullshit, it&#8217;s going to go away.</p>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/the-art-of-the-conference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copy text to clipboard in AS3</title>
		<link>http://dispatchevent.org/mims/as3-clipboard/</link>
		<comments>http://dispatchevent.org/mims/as3-clipboard/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 06:27:34 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[clipboard]]></category>
		<category><![CDATA[copypasta]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=825</guid>
		<description><![CDATA[Here&#8217;s how you do it! http://mandarin.no/as3/as3-snippet-1-copy-text-to-clipboard/]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how you do it!<br />
<a href="http://mandarin.no/as3/as3-snippet-1-copy-text-to-clipboard/">http://mandarin.no/as3/as3-snippet-1-copy-text-to-clipboard/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/as3-clipboard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using %tokens% with Flex resource bundles</title>
		<link>http://dispatchevent.org/mims/using-tokens-with-flex-resource-bundles/</link>
		<comments>http://dispatchevent.org/mims/using-tokens-with-flex-resource-bundles/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 19:26:08 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[resource bundles]]></category>
		<category><![CDATA[strings]]></category>
		<category><![CDATA[token]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=796</guid>
		<description><![CDATA[When I use Flex, I make extensive use of Resource Bundles for all but the most basic applications. In short, they allow you to keep all of your static string values (and non-string values) separated out of your code. That way, down the line it&#8217;s a very easy change when you want to localize the [...]]]></description>
			<content:encoded><![CDATA[<p>When I use Flex, I make extensive use of <a href="http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WS2db454920e96a9e51e63e3d11c0bf69084-7fcf.html">Resource Bundles</a> for all but the most basic applications. In short, they allow you to keep all of your static string values (and non-string values) separated out of your code. That way, down the line it&#8217;s a very easy change when you want to localize the site in another language, rebrand it for another audience, or when a client asks you to change a button label or error message. Granted, this level of detail isn&#8217;t always necessary but I think it&#8217;s a good habit to get into even if it&#8217;s overkill for some projects.</p>
<p>But resource bundles can&#8217;t help you in every scenario. I often find myself needing to construct a sentence with live data inserted. For this, the resource strings are less helpful. For example, how would you write:</p>
<p><code>"At " + time + ", you received a message from " + userName + "."</code></p>
<p>With resource strings, you would have to do something like</p>
<pre>at=At
message=, you received a message from
period=.</pre>
<p>Which completely negates the whole point of using resource bundles. What to do?</p>
<h3>Token replacement</h3>
<p><img class="size-full wp-image-799 alignright" title="tokens" src="http://dispatchevent.org/wp-content/uploads/2009/12/tokens.jpg" alt="tokens" width="155" height="125" /><br />
What I really wanted was a way to inject data into the string. I&#8217;ve seen this done by use of tokens in other languages like <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Strings/Articles/FormatStrings.html#//apple_ref/doc/uid/20000943">Objective-C</a> so I thought I&#8217;d give it a try. The result was surprisingly lightweight.</p>
<p>I created this utility that lets you use tokens (delimited by % signs) that can be replaced by live data when you retrieve the resource. Using this class, the example above would look more like this:</p>
<pre>receivedMessage=At %time%, you received a message from %userName%.

// then in your code
trace(ResourceStringUtil.getResoureceStringWithTokens("receivedMessage", {time: "11:49", userName: "Mims"}));

// displays
At 11:49, you received a message from Mims.</pre>
<p>Here&#8217;s the source code Feel free to use it and modify it for your purposes.</p>
<p><script src="http://gist.github.com/251904.js?file=ResourceStringUtil.as"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/using-tokens-with-flex-resource-bundles/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using ant for Flex &#8211; a no B.S. guide &#8211; Part 4 of 4</title>
		<link>http://dispatchevent.org/mims/ant-for-flex-part-4/</link>
		<comments>http://dispatchevent.org/mims/ant-for-flex-part-4/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 03:31:43 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[flashbuilder]]></category>
		<category><![CDATA[flexbilder]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=771</guid>
		<description><![CDATA[Part 1 Part 2 Part 3 Part 4 Now that you&#8217;ve been through 3 exhaustive tutorials on ant for flex, it&#8217;s time to use your knowledge you&#8217;ve gained to turn your back on the built-in Flex compiler and switch to ant for your builds. This part applies to FlexBuilder (and FlashBuilder) users only although it [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-1/">Part 1</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-2/">Part 2</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-3/">Part 3</a></li>
<li>Part 4</li>
</ul>
<p>Now that you&#8217;ve been through 3 exhaustive tutorials on ant for flex, it&#8217;s time to use your knowledge you&#8217;ve gained to turn your back on the built-in Flex compiler and switch to ant for your builds. This part applies to FlexBuilder (and FlashBuilder) users only although it may apply if you&#8217;re using some other eclipse-based plugin. If you&#8217;re using another program like TextMate or Flash CSx, you can skip this article.<br />
<span id="more-771"></span></p>
<h3>Replacing the default builder with your ant tasks</h3>
<p>The rest of this article will show you how to use your ant build script to perform the building actions found in FlashBuilder.</p>
<p>In FlashBuilder, the following building actions can be executed</p>
<ul>
<li><strong>Build Project &#8211; </strong>Occurs when the user manually builds the project.</li>
<li><strong>Build Automatically &#8211; </strong>When the option is checked in the Project menu, the code is automatically build when you save a file. Usually incrementally.</li>
<li><strong>Clean</strong> &#8211; &#8216;cleans&#8217; the project folder by doing a complete, non-incremental build and removing temporary files.</li>
</ul>
<p>These actions are all called by various actions and handled by one or more <em>builders</em>. In terms of the eclipse SDK, a builder is an XML file that describes how the various build actions will be executed. In FlashBuilder, all of these are set up to use the Flex &#8220;builder&#8221; by default. You can add new customized builders to supplement these build actions. You can also deactivate the default builder an just use your ant builds instead <strong>but you will lose the ability to see inline errors in your code</strong>.</p>
<p>In order for this to work however, you need to start out with some solid, well-tested ant tasks.</p>
<h4>Step 1 &#8211; Create the appropriate ant targets</h4>
<p>Create a target in your build.xml for each of the actions listed above. Call each target &#8220;build&#8221;, &#8220;autoBuild&#8221;, and &#8220;clean&#8221;. You can probably start with the &#8220;build&#8221; target and reuse it for the other two. To write an incremental build target (used for the build-automatically action) there is an example in<a href="http://dispatchevent.org/mims/ant-for-flex-part-2/"> Part 2</a> of this article.</p>
<p>Before moving on, please test your build script thoroughly to be sure there are no errors and that your files are compiling correctly.</p>
<p>Note, I&#8217;m not going to go into the details here about exactly how to write your ant script. If you&#8217;re considering switching to ant as your primary builder then A) your project has special needs that need to be addressed by a custom build script and I don&#8217;t know what those needs are and B) you need to know what you&#8217;re doing with ant before completely abandoning FlashBuilder&#8217;s defaults. I will say, save the fancy stuff for your release build targets and do incremental builds by default since you&#8217;ll be running these scripts quite a lot.</p>
<h4>Step 2 &#8211; Create a builder for your ant build script</h4>
<ol>
<li>Open the properties for the project you want to edit. <strong>Project -&gt; Properties</strong></li>
<li><strong>Select the Builders item</strong> in the left menu. You will see that the default builder &#8220;Flex&#8221; is already set up.</li>
<li><strong>Click the New&#8230; button</strong>. A dialog will come up with templates for the new builder.</li>
<li><strong>Choose the &#8220;Program&#8221; type</strong>. (On my configuration, I see an option for &#8220;Ant Builder&#8221; also which is what I should probably be using, however, I haven&#8217;t gotten it to work yet and it doesn&#8217;t seem to generate any specific errors when it fails so I gave up and went with Program. If you know how to fix this, let me know!)</li>
<li><strong>Name the builder &#8220;flexAntBuilder&#8221;</strong></li>
<li><strong>Set the location field to the ant binary you&#8217;re using.</strong> If you&#8217;re not sure where the binary is located, you can use the command <code>which ant</code> in the command line. Mine is at <code>/usr/bin/ant</code></li>
<li><strong>Set the Working directory to your project&#8217;s home directory</strong>. If you&#8217;re not sure, browse to it.</li>
<li><strong>In the arguments field, enter the name of the target you want to run. </strong>In this case <code>build</code>.</li>
<li><strong>Optional: Click on the Refresh tab.</strong> Here you can chose whether to refresh the files in your workspace when the build completes.</li>
<li><strong>Click on the Build Options tab. </strong>Here, under the &#8220;Run the Builder:&#8221; heading near the bottom, is where you&#8217;re going to set the properties that determine when this particular task is run. For the &#8216;build&#8217; target, <strong>uncheck everything except &#8220;During Manual Builds&#8221;.</strong>
<ul>
<li>For your &#8220;autoBuild&#8221; target, you&#8217;re going to uncheck everything except &#8220;During auto builds&#8221;</li>
<li>For your &#8220;clean&#8221; target, you&#8217;re going to uncheck everything except &#8220;After a clean&#8221;</li>
</ul>
</li>
<li><strong>Repeat steps 1-10 for the other two targets.</strong></li>
<li>When all targets are added,<strong> </strong><strong>optionally</strong><strong> uncheck the &#8220;flex&#8221; builder from the builders menu in your project properties to use the ant tasks exclusively.</strong> Now your ant scripts will be used instead of the flex builder.</li>
</ol>
<p>That&#8217;s it! Be sure to test things and make sure you&#8217;re not getting any errors.</p>
<h4>What to expect from here</h4>
<p>So you&#8217;ve unchained yourself from the system and are using your ant scripts to build your project. Congratulations, you&#8217;re a huge nerd! From this point on, changing the compile settings in the Project Properties dialog (like the build path) may be ineffective. You&#8217;ll need to make changes to your build path in the ant file.</p>
<p>The results from your builds will appear in the Console view. Here you can see the progress of builds and check for errors in the code. As I mentioned before, if you deactivate the flex builder you won&#8217;t get inline errors in your code any longer.</p>
<p>Finally, adding the new builders will create a new invisible folder in your project&#8217;s root folder called .externalToolBuilders where your builder definitions will be kept. You don&#8217;t need to do anything with this folder, but be aware that it&#8217;s there.</p>
<p>That concludes this 4 part epic post about ant tasks for flex! I hope you found it useful. If you have anything to add, please post comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/ant-for-flex-part-4/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using ant for Flex &#8211; a no B.S. guide &#8211; Part 3 of 4</title>
		<link>http://dispatchevent.org/mims/ant-for-flex-part-3/</link>
		<comments>http://dispatchevent.org/mims/ant-for-flex-part-3/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 01:31:16 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[flexbuilder]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=763</guid>
		<description><![CDATA[Part 1 Part 2 Part 3 Part 4 This third installment talks about tips and tricks for using ant with version control systems. Defining external properties for each user Since not everyone&#8217;s machine is the same and letting everyone build a project is a major reason to use ant, it&#8217;s good to avoid hard coding [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-1/">Part 1</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-2/">Part 2</a></li>
<li>Part 3</li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-4/">Part 4</a></li>
</ul>
<p>This third installment talks about tips and tricks for using ant with version control systems.<br />
<span id="more-763"></span></p>
<h3>Defining external properties for each user</h3>
<p>Since not everyone&#8217;s machine is the same and letting everyone build a project is a major reason to use ant, it&#8217;s good to avoid hard coding paths to files within your build.xml file. As such, I use a lot of &lt;property&gt; tags to set up paths and such. But you also don&#8217;t want to have several people constantly editing your build.xml because it could get broken or out of sync. Oh no! What do we do!?</p>
<p>Luckily, ant lets you define a set of properties in an external file. This is a simple text file containing name=value pairs and commented using #. By default, the recommended filename is build.properties.  Here&#8217;s an example:<br />
<script src="http://gist.github.com/234318.js"></script></p>
<h4>build.properties and version control</h4>
<p>If you&#8217;re working with multiple people, you are probably using a version control system like svn. If you are and you want to avoid people accidentally checking in a build.properties file there are a couple of simple tricks. First, create a copy of build.properties and call it <em>built.properties.template</em> and check that into the repository. Then each user can make a local copy called build.properties. You can also add build.properties to the ignore list for your folder using SVN so that noone will accidentally check it in. Run <code>svn pe svn:ignore</code> and add build.properties to the list. Finally, if you need to make sure that your users have a local copy of  build.properties, <em>there&#8217;s a task for that!â„¢</em> <script src="http://gist.github.com/234320.js"></script></p>
<h3>Adding SVN tasks</h3>
<p>As I work with SVN quite a lot, I found that including SVN in my builds can be quite useful. For example you could:</p>
<ul>
<li>Update your working copy when doing a clean build.</li>
<li>Check in a release build automatically.</li>
<li>Export your source code without those pesky .svn files to be included in a zip file.</li>
<li>Include the revision number of the working copy as a constant definition in the code using <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html#246171">conditional compiliation</a>.</li>
</ul>
<p>To do this, you&#8217;ll need to first download the SVN tasks for ant. They can be found on the <a href="http://subclipse.tigris.org/svnant.html">Tigris.org</a> website. Please note, that these tasks are a part of <a href="http://subclipse.tigris.org/">SubClipse</a>, which is a free interface for working with Subversion from within Eclipse. I don&#8217;t know if the tasks will work without subclispe, but if you haven&#8217;t used it, I&#8217;d definitely recommend trying it out anyway.  By the way, if you use CVS, there are already tasks included in ant.  Once they&#8217;re downloaded, add the task .jars to the libs/ant folder in your project. You&#8217;ll need to use another &lt;typedef&gt; tag in your build script to get these to work. Here&#8217;s an example snippet that simply runs an update on the working copy. You can see all the available commands in the <a href="http://subclipse.tigris.org/svnant/svn.html">svnant documentation</a>.  <script src="http://gist.github.com/234312.js"></script></p>
<p>That&#8217;s it for part 3. In <a href="http://dispatchevent.org/mims/ant-for-flex-part-4/">Part 4</a>, I&#8217;ll talk about setting up a builder for your ant file in FlashBuilder.</p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/ant-for-flex-part-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using ant for Flex &#8211; a no B.S. guide &#8211; Part 2 of 4</title>
		<link>http://dispatchevent.org/mims/ant-for-flex-part-2/</link>
		<comments>http://dispatchevent.org/mims/ant-for-flex-part-2/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 01:20:37 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[flexbuilder]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tasks]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=760</guid>
		<description><![CDATA[Part 1 Part 2 Part 3 Part 4 In this part, I get more nitty-gritty about working with flex&#8217;s ant tasks. Using the flex ant tasks I spent quite a lot of time making tweaks to get my scripts to use the Flex tasks and hopefully, now you won&#8217;t have to. In the end, there&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-1/">Part 1</a></li>
<li>Part 2</li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-3/">Part 3</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-4/">Part 4</a></li>
</ul>
<p>In this part, I get more nitty-gritty about working with flex&#8217;s ant tasks.<br />
<span id="more-760"></span></p>
<h3>Using the flex ant tasks</h3>
<p>I spent quite a lot of time making tweaks to get my scripts to use the Flex tasks and hopefully, now you won&#8217;t have to. In the end, <strong>there&#8217;s very little benefit to using the official Flex ant tasks over using a generic &lt;exec&gt; task</strong> (a type of ant task that simply runs an executable file with nested &lt;arg&gt; tags for command line arguments) <strong>and if you&#8217;re having trouble with them, I&#8217;d recommend abandoning the flex tasks and using $lt;exec&gt;</strong>. The main thing I had trouble with was getting the &lt;taskdef&gt; tag to work correctly.</p>
<p>For those new to ant, a &lt;taskdef&gt; tag is a required tag that defines a third-party ant task within the build.xml file. It associates a task name with a .jar file (compiled from the java code for the task). In the case of flex tasks, the java file is typically located within your flexbuilder sdk directory. On my mac, that&#8217;s here:</p>
<p>/Applications/Adobe\ Flash\ Builder\ Plug-in\ Beta\ 2/sdks/${SDK_VERSION}/ant/lib</p>
<p>Where ${SDK_VERSION} is your target sdk version (e.g. 4.0.0). There are a few ways to load additional tasks into your build.xml file. All of them require you to reference the .jar&#8217;s location somehow and then define a new task using &lt;taskdef&gt;.</p>
<ol>
<li><strong>Copy the .jar file for the task into ant&#8217;s lib directory.</strong> I don&#8217;t personally like this option because it makes it very difficult to switch between different versions of the sdk. Also, it requires all users of the script to copy the files on their local machines. (You can also add it to ~/<code>.ant/lib </code>to control the libraries on a user level)</li>
<li><strong>Reference the .jar file&#8217;s location using a command line argument -lib</strong>. Even worse than the first option since it requires each user to add the library manually every time the build script is run.</li>
<li><strong>Include the .jar&#8217;s location inside the build script.</strong> It took me a long time to figure this one out since I didn&#8217;t see it in the manual for ant, but it&#8217;s certainly my preferred method for adding tasks. It allows you to keep everything self contained within the build.xml so changing the location of the .jar is as simple as setting a property in the build script.</li>
</ol>
<p>When using the 3rd option, you then have the question of where is the best place to put the .jar files you want to link to. There are two options that make sense to me.</p>
<ol>
<li>The best place to put non-core tasks required by your build (for a Flex project) is in ${project_home}/libs/ant. This allows you to check your tasks into a repository along with your other referenced files (like .swc files).</li>
<li>Optionally, for the flex tasks you could reference the .jar file directly in the sdk folder. Use this option if the version number of the SDK doesn&#8217;t matter. If it does matter, use the first option. I use this option in my snippet below.</li>
</ol>
<h4>Linking to the official Flex ant tasks</h4>
<p>Here&#8217;s a sample of my flex task definition along with some path definitions that point to various parts of Flex. I said this was a no B.S. guide so if you paste this snippet into your build script, you should be able to use the Flex tasks.<br />
<script src="http://gist.github.com/233455.js?file=FlexAntTaskDefs.xml"></script></p>
<h4>Using the tasks</h4>
<p>Now we have the &lt;typedef&gt; in place and we can actually create a task to compile something. Again, I&#8217;m not going to go into all the details of what <a href="http://ant.apache.org/manual/using.html#targets">targets</a> are all about or go into all the details about the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_22.html">flex compilers</a>. There are plenty of other tutorials about that. Instead, I&#8217;ll show you a basic target to build an mxml file that is adequate for 95% of projects. Note: you may need to edit the properties defined in these scripts so that they point to the right paths for your project.</p>
<p><script src="http://gist.github.com/234291.js"></script> The toughest part about using these tasks is the seemingly arbitrary words that they expect for the attribute names of some tags (like using <em>path-element</em> in the &lt;source-path&gt; tag but <em>dir</em> in the &lt;library-path&gt; tag). Now the same but this time building a library SWC.  <script src="http://gist.github.com/234288.js"></script></p>
<h4>Making an incremental build</h4>
<p>By default, FlexBuilder uses incremental builds when compiling your source code (except for clean builds). This is a very useful feature of the compiler because it saves time by only compiling the parts of your code that have changed since the last build. You can create an incremental build simply using ant by defining a second task that adds a flag  for incremental building like so. Note that  allows you to run other targets from within a target.</p>
<p><script src="http://gist.github.com/234287.js"></script></p>
<h4>What about ASDocs?</h4>
<p>Even though there are tasks for asc, compc, mxmlc, and generating HTML wrappers, they didn&#8217;t bother to include an asdoc task (actually, they did in Flex SDK 4.0.0). But that&#8217;s okay! As I hinted at earlier, you can still use the  task to run this (as you can for all the other commands) and not only that, it&#8217;s way easier to set up than the official flex tasks! In fact, the only reason that I can think of to use the flex tasks is that they would automatically  use the windows or mac version of the executable depending on your platform. Here&#8217;s an example for asdoc.  <script src="http://gist.github.com/234294.js"></script></p>
<p>That concludes part 2. In <a href="http://dispatchevent.org/mims/ant-for-flex-part-3/">Part 3</a>, I&#8217;ll talk about working with version control systems in ant.</p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/ant-for-flex-part-2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using ant for Flex &#8211; a no B.S. guide &#8211; Part 1 of 4</title>
		<link>http://dispatchevent.org/mims/ant-for-flex-part-1/</link>
		<comments>http://dispatchevent.org/mims/ant-for-flex-part-1/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 01:15:52 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Greatest Hits]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[flashbuilder]]></category>
		<category><![CDATA[flexbuilder]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[tasks]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=746</guid>
		<description><![CDATA[After spending hours wrangling with my ant build script and finally making everything work correctly, I am convinced of two things: ant is a very powerful tool for compiling code but it can also do so much more. The support for ant for flex online is abysmally frustrating. So, I&#8217;d love to share with you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dispatchevent.org/wp-content/uploads/2009/11/QueenAnt.jpg"><img class="alignnone size-full wp-image-784" title="ant" src="http://dispatchevent.org/wp-content/uploads/2009/11/QueenAnt.jpg" alt="About to burst with build targets" width="159" height="159" /></a></p>
<p>After spending hours wrangling with my ant build script and finally making everything work correctly, I am convinced of two things:</p>
<ol>
<li><a href="http://ant.apache.org/manual/index.html">ant</a> is a very powerful tool for compiling code but it can also do so much more.</li>
<li>The support for ant for flex online is abysmally frustrating.</li>
</ol>
<p>So, I&#8217;d love to share with you some of the tips I&#8217;ve picked up after tweaking my script to the point where it finally worked!</p>
<h3>Introducing ant</h3>
<p>First of all, let me introduce the basics of what ant is. I couldn&#8217;t really say it better than the thousands of nameless editors of <a href="http://en.wikipedia.org/wiki/Apache_Ant">WikiPedia</a>.</p>
<blockquote><p><strong>Apache Ant</strong> is a software tool for <a title="Build automation" href="http://en.wikipedia.org/wiki/Build_automation">automating software build</a> processes. It is similar to <a title="Make (software)" href="http://en.wikipedia.org/wiki/Make_%28software%29">Make</a> but is implemented using the <a title="Java (programming language)" href="http://en.wikipedia.org/wiki/Java_%28programming_language%29">Java</a> language, requires the Java platform, and is best suited to building Java projects.</p>
<p>The most immediately noticeable difference between Ant and Make is that Ant uses <a title="XML" href="http://en.wikipedia.org/wiki/XML">XML</a> to describe the build process and its dependencies, whereas Make has its Makefile format. By default the XML file is named <code>build.xml</code>.</p>
<p>Ant is an <a title="Apache Software Foundation" href="http://en.wikipedia.org/wiki/Apache_Software_Foundation">Apache</a> project. It is <a title="Open source software" href="http://en.wikipedia.org/wiki/Open_source_software">open source software</a>, and is released under the <a title="Apache Software License" href="http://en.wikipedia.org/wiki/Apache_Software_License">Apache Software License</a>.</p></blockquote>
<p>So in short, ant lets you use an XML based script to run a series of commands typically used to build software projects. It was originally designed to be &#8220;for Java, in Java&#8221; but it&#8217;s popularity and ease of use has created interest beyond the Java community. For flex, ant can be used for compiling ActionScript and Flex projects into SWFs, creating SWC files, generating documentation with ASDocs, and other actions associated with compiling.</p>
<p>There are a lot of great tutorials online that can cover the basics of how ant works so I&#8217;m not going to go into a general overview in this article. Instead, I&#8217;m going to try to focus on some of the practical aspects of getting a build set up when working with Flex. However, here are some links to the <a href="http://ant.apache.org/manual/">official ant documentation</a> some helpful tutorials for the basics:</p>
<p><a href="http://www.allapplabs.com/ant/ant_basics.htm">Ant Basics tutorial</a></p>
<p><a href="http://flexblog.faratasystems.com/2006/12/05/intro-to-building-and-deploying-flex-applications-with-ant">Another basics tutorial (this time for Flex)</a></p>
<p><a href="http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html">Official Flex documentations</a></p>
<p><a href="http://wiki.apache.org/ant/AntTasks">Ant Folklore</a></p>
<p>After the jump, I&#8217;ll get into some of the ways that ant can be useful for Flash and Flex projects.<br />
<span id="more-746"></span> </p>
<h4>Applications for Flex users</h4>
<p>Is ant right for you? It depends. For most cases, using the standard Run and Debug functions in FlashBuilder or Flash will be completely sufficient. However, if you work on a large development team or on a project with a complicated build process, it might save the group a lot of headache. Here&#8217;s a list of situations where I think Flex ant tasks can be helpful.</p>
<ul>
<li>Whenever your project requires you to make adjustments to the standard build process. For example, when you need to add additional flags to your compiler string.</li>
<li>For Flex projects that are distributed widely, e.g. open source projects, where the configuration of the users&#8217; dev environment is unknown. Build scripts allow users of various versions of FlexBuilder, FDT, or Flex SDK users on different operating systems to all be able to compile a project with more or less the same settings.</li>
<li>If running or building your project requires you to configure options in the command line or to run a local server.</li>
<li>For building release versions of an app and for deploying your app. For example, compiling, zipping and copying an app to a server using FTP.</li>
<li>When you&#8217;re a total nerd and you want to use ant just so you can say you did it.</li>
</ul>
<h3>Beyond Compiling</h3>
<p>One of the main benefits of using ant is that I think many people are unaware of is that it can be  used for many things beyond running compilers. For example, in <a href="http://code.google.com/p/kitchensynclib/">KitchenSync</a>, I use a <a href="http://code.google.com/p/kitchensynclib/source/browse/trunk/build.xml">build script</a> to create a temp folder, compile a SWC file into the temp folder, create an SVN export of the source folder into the temp folder, zip the source and SWC and name it with the current version number, then delete the temp folder.</p>
<p>There are loads of <a href="http://ant.apache.org/manual/coretasklist.html">core tasks</a> that are already defined within the ant library. They handle all types of common actions in the command line. There are even additional <a href="http://ant.apache.org/manual/optionaltasklist.html">optional tasks</a> that add higher-level functionality like copying files to a server using SSH or validating an XML file. Finally, additional tasks can be added simply by creating a new Java class that is a subclass of <code>org.apache.tools.ant.Task</code>. You probably won&#8217;t do this yourself, but there are a number of third-party programs that have created &#8216;plug-in&#8217; tasks for ant such as SVN.</p>
<p>Once Flex projects became larger and more complex, many users began to look for more customizable options and began using ant. A couple of years back, Adobe released some official ant tasks which can now be found bundled in every version of the Flex SDK. However, as I said before the documentation of exactly how to get these tasks running is vague at best.</p>
<p>In <a href="http://dispatchevent.org/mims/ant-for-flex-part-2/">part 2</a>, I&#8217;ll talk about the details of getting flex ant tasks running.</p>
<ul>
<li>Part 1</li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-2/">Part 2</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-3/">Part 3</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-4/">Part 4</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/ant-for-flex-part-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>FlexBuilder / Eclipse keyboard shortcuts that will change your life</title>
		<link>http://dispatchevent.org/mims/flexbuilder-keyboard-shortcuts/</link>
		<comments>http://dispatchevent.org/mims/flexbuilder-keyboard-shortcuts/#comments</comments>
		<pubDate>Fri, 01 May 2009 21:09:15 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[clip-n-save]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[flexbuilder]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[shortcut]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=707</guid>
		<description><![CDATA[Control + O = Open an outline of functions within the current class to jump to. Command + Shift + T = Jump to a type (class or interface). Only works when an .as or .mxml file is open. Command + Shift + R = Jump to a resource. Includes classes and any other files [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li><strong>Control + O</strong> = Open an outline of functions within the current class to jump to.</li>
<li><strong>Command + Shift + T </strong>= Jump to a type (class or interface). Only works when an .as or .mxml file is open.</li>
<li><strong>Command + Shift + R</strong> = Jump to a resource. Includes classes and any other files (such as XML files)</li>
<li><strong>Command + L</strong> = Jump to a line number</li>
<li><strong>Command + Shift + C</strong> = Wrap / Unwrap selected text in a block comment (/* */)</li>
<li><strong>Command + Shift + /</strong> = Comment / uncomment the selected line usingÂ  an inline comment (//)</li>
<li><strong>Command + Shift + D</strong> = Add ASDoc style comment</li>
<li><strong>Command + D</strong> = Delete the selected text</li>
<li><strong>Command + UP</strong> = Move the selected up</li>
<li><strong>Command + DOWN</strong> = Move the selected text down</li>
<li><strong>Command + Option + UP</strong> or <strong>DOWN</strong> = Duplicate the selected text above or below the selected line</li>
<li><strong>Command + X</strong> = Make selected text ALL CAPS</li>
<li><strong>Command + Y</strong> = Make selected text all lowercase</li>
<li><strong>Command + Shift + R</strong> = Rename selected element (using refactor)</li>
<li><strong>Command + M</strong> = Maximize / Minimize current view</li>
<li><strong>Control + Tab</strong> = Jump to an open file editor</li>
<li><strong>Command + Shift + L</strong> = Keyboard command list. Press it again to edit commands.</li>
<li><strong>Command + F</strong> = Find / Replace dialog.</li>
<li><strong>Command + Shift + G</strong> = Find any references to the selected element within your project</li>
<li><strong>Command + Click</strong> or<strong> F3</strong> = Jump to the definition of the selected element</li>
<li><strong>Command + J</strong> = Find within document. Type the word you want to find then use up and down to skip between instances. Press ESC to cancel.</li>
<li><strong>Command + Shift + P</strong> = Jump to matching bracket. e.g. jump from } to {</li>
<li><strong>Control + H</strong> = Search (rather than find) allows you to search within the entire workspace.</li>
<li><strong>Tab / Shift + Tab </strong>= Indent / Un-indent selected text.</li>
<li><strong>Command + Option + Left / Right</strong> = Jumps to the location of the previous / next edit without undoing your change.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/flexbuilder-keyboard-shortcuts/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Using XML Schemas in Eclipse / FlexBuilder</title>
		<link>http://dispatchevent.org/mims/using-xml-schemas-in-eclipse-flexbuilder/</link>
		<comments>http://dispatchevent.org/mims/using-xml-schemas-in-eclipse-flexbuilder/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 05:00:16 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[flexbuilder]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xml-schema]]></category>
		<category><![CDATA[xsd]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=626</guid>
		<description><![CDATA[UPDATE: After reading the entry by Misprintt on the SchemaManager and XMLDecoder more thoroughly, I felt the need to tell you all to go check it out! This is a very powerful undocumented feature of Flex (why undocumented?) that could potentially save loads of time on a larger project. Along with the rest of this [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE:</strong> After reading the <a href="http://blog.misprintt.net/?p=192">entry by Misprintt on the SchemaManager and XMLDecoder</a> more thoroughly, I felt the need to tell you all to go check it out! This is a very powerful undocumented feature of Flex (why undocumented?) that could potentially save loads of time on a larger project. Along with the rest of this article, you could automate the parsing of your XML files into bindable model classes with ease.</p>
<p><a href="http://www.w3schools.com/Schema/default.asp">XML-Schema</a> (.XSD extension) are documents used to describe the format of XML files. They are similar to DTD (Document type declaration) files but much more powerful.</p>
<p><a href="http://dispatchevent.org/wp-content/uploads/2009/02/picture-1.png"><img class="alignnone size-full wp-image-633" title="xsd editor" src="http://dispatchevent.org/wp-content/uploads/2009/02/picture-1.png" alt="xsd editor" width="435" height="355" /></a></p>
<p>While working on some XML documents for a Flash site, I stumbled across the XML-Schema editor for Eclipse. The editor shows the XSD as a graphical representation of the model that you&#8217;re editing that looks similar to a UML class diagram.</p>
<p><a href="http://wiki.eclipse.org/index.php/Introduction_to_the_XSD_Editor">Here&#8217;s a great article on how it works.</a></p>
<h3><span id="more-626"></span>Benefits of using XSD</h3>
<p>As I said, XSD allows you to define the format of your XML document but with much more detail that DTD.</p>
<ul>
<li>XSD allows you to type your data (integers, strings, booleans) so that you can better predict what format the xml will be</li>
<li>It allows the creation of custom types which gives it an object oriented aspect</li>
<li>You can use all kinds of restrictions for what kind of content can appear within a tag including the number of elements, whether values are required or not, you can even use regular expressions to limit the acceptable values. This is very nice when you&#8217;re working with a 3rd party who is generating the XML data.</li>
<li>Using an XSD file can allow you to automate the validation of an XML file&#8217;s format</li>
</ul>
<p>Once you&#8217;ve created your XSD file, you can use the new XML document wizard to create an XML file that links to your schema file. The wizard will automatically populate the XML document with valid data! Furthermore, as you edit the XML file you will get warnings and errors if you go outside the formatting requirements defined in the XSD. For example, if you define a tag &lt;description&gt; as having a maximum length of 128, you will see a visual error if your tag contains more than 128 characters. It&#8217;s a great way to forsee problems as you write them.</p>
<p><span style="text-decoration: line-through;">I hope in the future to write some kind of tool to parse XML based on an XSD file in flash.</span> Apparently, Adobe had created an undocumented Flex feature to validate XML against XSD. <a href="http://blog.misprintt.net/?p=181">Via Misprintt</a></p>
<h3>Installing the XML extensions</h3>
<p>Unfortunately, the editor is not installed by default and nstalling software in Eclipse is not very intuitive. I&#8217;ve done my best to describe the process here but if you need further help, <a href="http://dispatchevent.org/mims/pimp-my-clipse-a-list-of-must-have-eclipse-plug-ins-for-flexflash-development/">check this entry</a>.</p>
<ol>
<li>Open Eclipse or FlexBuilder</li>
<li>Go to Help&gt;Software Updates&#8230; ( &gt; Find and Install for Eclipse 3.3)<br />
<a href="http://dispatchevent.org/wp-content/uploads/2009/02/softwareupdate.png"><img class="alignnone size-full wp-image-630" title="softwareupdate" src="http://dispatchevent.org/wp-content/uploads/2009/02/softwareupdate.png" alt="softwareupdate" /></a></li>
<li>Make sure you have the <a href="http://www.eclipse.org/europa/">Europa</a> or <a href="http://www.eclipse.org/ganymede/">Ganymede</a> update sites in the list of update sites:
<pre style="margin: 0em;">Eclipse 3.4 users:
<a class="external free" title="http://download.eclipse.org/releases/ganymede/" rel="nofollow" href="http://download.eclipse.org/releases/ganymede/">http://download.eclipse.org/releases/ganymede/</a>

<a href="http://download.eclipse.org/releases/europa/site.xml">http://download.eclipse.org/releases/europa/site.xml</a></pre>
</li>
<li>Select the XML and XSD extensions in this screenshot. In Eclipse 3.4 you can search for them, in 3.3 you will have to look through the packages for them manually.<a href="http://dispatchevent.org/wp-content/uploads/2009/02/xmlextensions.png"><img class="alignnone size-full wp-image-629" title="xmlextensions" src="http://dispatchevent.org/wp-content/uploads/2009/02/xmlextensions.png" alt="xmlextensions" width="400" /></a></li>
<li>Restart Eclipse after the install is complete</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/using-xml-schemas-in-eclipse-flexbuilder/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

