<?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>Things That Work &#187; Flex</title>
	<atom:link href="http://thingsthatwork.net/index.php/category/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://thingsthatwork.net</link>
	<description>Thoughts on life and code</description>
	<lastBuildDate>Tue, 16 Feb 2010 00:25:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Obscure AS3 for-switch-if-false bug (VerifyError)</title>
		<link>http://thingsthatwork.net/index.php/2008/12/09/obscure-as3-for-switch-if-false-verify-erro/</link>
		<comments>http://thingsthatwork.net/index.php/2008/12/09/obscure-as3-for-switch-if-false-verify-erro/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 23:02:32 +0000</pubDate>
		<dc:creator>Katy Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Things That Don't Work]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://thingsthatwork.net/?p=22</guid>
		<description><![CDATA[So we finally tracked down just how Jay broke Grooveshark Lite the other day.
He apparently managed to trigger a very obscure language bug, that no one has really posted about, though if you dig deep enough into Adobe&#8217;s bug tracking system, you can find some reports of, though it&#8217;s supposedly fixed as of some version [...]]]></description>
			<content:encoded><![CDATA[<p>So we finally tracked down just how Jay <a href="http://wanderr.com/jay/how-i-broke-grooveshark-lite/2008/12/07/" target="_blank">broke Grooveshark Lite</a> the other day.</p>
<p>He apparently managed to trigger a very obscure language bug, that no one has really posted about, though if you dig deep enough into Adobe&#8217;s bug tracking system, you can find some reports of, though it&#8217;s supposedly fixed as of some version of the compiler that I have no idea if it&#8217;s in production yet.</p>
<p>This is all it takes to break Actionscript with a nasty runtime error:</p>
<pre><code>
private function breakIt():void
{
    var arr:Array = [];
    for each (var obj:Object in arr) {
        switch ('s') {
            case 's':
                if (null) {
                }
            //break;
        }
    }
}
</code></pre>
<p>The key here is the nested for/switch/if and that the expression for the if statement evaluates to false, and that there is nothing in the case after the if.</p>
<p>Uncommenting the commented break statement will prevent the bug. Even a variable declaration on that line will prevent the bug. Removing the switch from inside the for loop will prevent the bug. Notice in this case the loop shouldn&#8217;t even be executing: the array is empty. Doesn&#8217;t matter, it crashes anyway.</p>
<p>The runtime error this triggers is &#8220;VerifyError: Error #1068: CLASSNAME and CLASSNAME cannot be reconciled.&#8221; where CLASSNAME is the name of the class that contains the above code.</p>
<p>So if you&#8217;re getting the above error in your code, check around for any constructs like the above. </p>
]]></content:encoded>
			<wfw:commentRss>http://thingsthatwork.net/index.php/2008/12/09/obscure-as3-for-switch-if-false-verify-erro/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>&lt;mx:Array&gt; comes in handy for States</title>
		<link>http://thingsthatwork.net/index.php/2008/12/02/mxml-array-handy-for-states/</link>
		<comments>http://thingsthatwork.net/index.php/2008/12/02/mxml-array-handy-for-states/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 00:13:43 +0000</pubDate>
		<dc:creator>Katy Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://thingsthatwork.net/?p=21</guid>
		<description><![CDATA[Consider this situation:
You have an MXML component with multiple states. Each of these states has an associated error state that&#8217;s based on one of the other states. The overrides for each of the error states is identical &#8211; all that&#8217;s different is which state each error state is based on. Instead of duplicating the overrides [...]]]></description>
			<content:encoded><![CDATA[<p>Consider this situation:</p>
<p>You have an MXML component with multiple states. Each of these states has an associated error state that&#8217;s based on one of the other states. The overrides for each of the error states is identical &#8211; all that&#8217;s different is which state each error state is based on. Instead of duplicating the overrides for each error state, you can declare the overrides in an &lt;mx:Array&gt; tag, and use data binding to set the overrides property of each error state to the same array.</p>
<p>Alright, talking about this abstractly is kinda confusing. It will make perfect sense as soon as you see an example:</p>
<p><code></p>
<pre>
&lt;mx:Array id="errorOverrides"&gt;
    &lt;mx:AddChild relativeTo="{msgWrapper}"&gt;
        &lt;mx:Label text="The following errors occurred:" styleName="popupMessageError"/&gt;
    &lt;/mx:AddChild&gt;
    &lt;mx:AddChild relativeTo="{msgWrapper}"&gt;
        &lt;mx:VBox paddingLeft="15"&gt;
            &lt;mx:Repeater id="errorRepeater" dataProvider="{errors}" recycleChildren="true"&gt;
                &lt;mx:Text width="{msgWrapper.width-45}" text="{errorRepeater.currentItem}"/&gt;
            &lt;/mx:Repeater&gt;
        &lt;/mx:VBox&gt;
    &lt;/mx:AddChild&gt;
&lt;/mx:Array&gt;

&lt;states&gt;
    &lt;mx:State name="twitterBroadcast"&gt;
        &lt;mx:SetProperty target="{this}" name="bodyContent" value="{twitterBroadcastBodyContent}"/&gt;
        &lt;mx:SetProperty target="{this}" name="title" value="Broadcast to Twitter"/&gt;
    &lt;/mx:State&gt;

    &lt;mx:State name="facebookBroadcast"&gt;
        &lt;mx:SetProperty target="{this}" name="bodyContent" value="{facebookBroadcastBodyContent}"/&gt;
        &lt;mx:SetProperty target="{this}" name="title" value="Broadcast to Facebook"/&gt;
    &lt;/mx:State&gt;

    &lt;mx:State name="shareError" overrides="{errorOverrides}"/&gt;
    &lt;mx:State name="twitterError" basedOn="twitterBroadcast" overrides="{errorOverrides}"/&gt;
    &lt;mx:State name="facebookError" basedOn="facebookBroadcast" overrides="{errorOverrides}"/&gt;
&lt;/states&gt;
</pre>
<p></code></p>
<p>This solution seems obvious as soon as you think about how you would go about declaring these states in Actionscript, but in MXML it&#8217;s really easy to feel like you would need to declare the overrides over again inside each &lt;mx:State&gt; tag.</p>
<p>Maybe I&#8217;m late to the party and everyone else figured this out already, but if not, hopefully this post will help you think about MXML in a new way.</p>
]]></content:encoded>
			<wfw:commentRss>http://thingsthatwork.net/index.php/2008/12/02/mxml-array-handy-for-states/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Repeater performance and recycleChildren</title>
		<link>http://thingsthatwork.net/index.php/2008/11/07/repeater-performance-and-recyclechildren/</link>
		<comments>http://thingsthatwork.net/index.php/2008/11/07/repeater-performance-and-recyclechildren/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 01:29:23 +0000</pubDate>
		<dc:creator>Katy Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://thingsthatwork.net/?p=19</guid>
		<description><![CDATA[So one of my bug reports this week was that Lite took an insanely long time to populate the list of playlists when you clicked the &#8220;Add to Playlist&#8221; button on a song&#8217;s info panel. We&#8217;re talking like, click the button, lightbox opens, 4-5 seconds later your playlists appear. This was happening even for accounts [...]]]></description>
			<content:encoded><![CDATA[<p>So one of my bug reports this week was that Lite took an insanely long time to populate the list of playlists when you clicked the &#8220;Add to Playlist&#8221; button on a song&#8217;s info panel. We&#8217;re talking like, click the button, lightbox opens, 4-5 seconds later your playlists appear. This was happening even for accounts with a small number of playlists.</p>
<p>At first I thought it must be something with the service call to the backend to fetch the list of playlists, but it was returning long before the list rendered.</p>
<p>So then I thought perhaps it was the class I wrote for paging lists of stuff from the backend, but no, parsing the data wasn&#8217;t taking that long either.</p>
<p>So I went to make sure I hadn&#8217;t done anything silly in the view, like, manually removed and replaced all the children in the box every time the list changed instead of just using a Repeater. But no, I was using a Repeater. Jay says, &#8220;What&#8217;s this recycleChildren property on the Repeater class?&#8221;</p>
<p>I said, &#8220;That shouldn&#8217;t matter, this is the first time that Repeater&#8217;s been rendered. There&#8217;s no children created yet *to* recycle. But I guess I&#8217;ll set it true anyway.&#8221;</p>
<p>And sure enough, now it renders in more like 1 second, as opposed to 4-5. I understand how recycleChildren increases performance when the data in the dataProvider changes. I think it&#8217;s silly that it defaults to false &#8211; I&#8217;d think that most common uses of the Repeater class would benefit from defaulting to true, and if you have a case where you need it false, then you can specify. But I still don&#8217;t understand how it&#8217;s faster when it&#8217;s the first time it&#8217;s created any children at all.</p>
<p>So if your Repeaters are slow &#8211; set recycleChildren to true!</p>
<p>And if anyone can give some insight into how it&#8217;s faster even on the initial creation of the component, let me know. I&#8217;m curious.</p>
<p>And for you Grooveshark Lite fans &#8211; that change is live, so if you were frustrated by long lag times on the &#8220;Add to Playlist&#8221; lightbox, the &#8220;Share&#8221; lightbox, or on opening a playlist or song info panel, it should be much better now.</p>
]]></content:encoded>
			<wfw:commentRss>http://thingsthatwork.net/index.php/2008/11/07/repeater-performance-and-recyclechildren/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Comparison of Actionscript 3 vs Java</title>
		<link>http://thingsthatwork.net/index.php/2008/09/17/comparison-of-actionscript-3-vs-java/</link>
		<comments>http://thingsthatwork.net/index.php/2008/09/17/comparison-of-actionscript-3-vs-java/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 22:56:13 +0000</pubDate>
		<dc:creator>Katy Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://thingsthatwork.net/?p=18</guid>
		<description><![CDATA[Just found this today, and thought it was really interesting:
Syntax Comparison of Java 5 and Actionscript 3
]]></description>
			<content:encoded><![CDATA[<p>Just found this today, and thought it was really interesting:</p>
<p><a href="http://flexblog.faratasystems.com/?p=115" target="_blank">Syntax Comparison of Java 5 and Actionscript 3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thingsthatwork.net/index.php/2008/09/17/comparison-of-actionscript-3-vs-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML Entities and Actionscript</title>
		<link>http://thingsthatwork.net/index.php/2008/06/26/html-entities-and-actionscript/</link>
		<comments>http://thingsthatwork.net/index.php/2008/06/26/html-entities-and-actionscript/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 23:43:54 +0000</pubDate>
		<dc:creator>Katy Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Things That Work]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[HTML Entities]]></category>

		<guid isPermaLink="false">http://thingsthatwork.net/?p=17</guid>
		<description><![CDATA[A couple weeks ago I needed to easily convert HTML entities in a string back to their normal representation, but I didn&#8217;t really find anything nice, and wound up just using str.replace(/&#38;/g, "&#038;").replace(/&#39;/g, "'"); since those were the only characters I was having a problem with at the time.
But today I went searching again for [...]]]></description>
			<content:encoded><![CDATA[<p>A couple weeks ago I needed to easily convert HTML entities in a string back to their normal representation, but I didn&#8217;t really find anything nice, and wound up just using <code>str.replace(/&amp;/g, "&#038;").replace(/&#39;/g, "'");</code> since those were the only characters I was having a problem with at the time.</p>
<p>But today I went searching again for something better, and found a really great way to <a href="http://www.razorberry.com/blog/archives/2007/11/02/converting-html-entities-in-as3/" target="_blank">escape and unescape HTML entities</a>. Not sure why I didn&#8217;t find his post the first time, I guess my Google-fu was weak that day.</p>
<p>Anyway, I&#8217;ve wrapped his methods up in a little helper class, and it works great:</p>
<p><code></p>
<pre>
package com.grooveshark.utils
{

    public class HTMLEntityUtils
    {
        import flash.xml.XMLDocument;
        import flash.xml.XMLNode;
        import flash.xml.XMLNodeType;

        public function HTMLEntityUtils()
        {
        }

        public static function htmlEscape(str:String):String
        {
            return XML(new XMLNode(XMLNodeType.TEXT_NODE, str)).toXMLString();
        }

        public static function htmlUnescape(str:String):String
        {
            return new XMLDocument(str).firstChild.nodeValue;
        }
    }
}
</pre>
<p></code></p>
<p>Hope it helps someone else!</p>
]]></content:encoded>
			<wfw:commentRss>http://thingsthatwork.net/index.php/2008/06/26/html-entities-and-actionscript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Welcome to Grooveshark Lite!</title>
		<link>http://thingsthatwork.net/index.php/2008/04/15/welcome-to-grooveshark-lite/</link>
		<comments>http://thingsthatwork.net/index.php/2008/04/15/welcome-to-grooveshark-lite/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 16:02:46 +0000</pubDate>
		<dc:creator>Katy Richard</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Grooveshark]]></category>
		<category><![CDATA[Grooveshark Lite]]></category>
		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://thingsthatwork.net/?p=15</guid>
		<description><![CDATA[Grooveshark Lite is now officially live.
Grooveshark Lite takes all the long-tail P2P musical goodness of Grooveshark.com and distills it in a handy quick interface to find and listen to whatever you want. Unlike the main Grooveshark site, you don&#8217;t have to have an account or install our Sharkbyte client in order to listen to music. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://listen.grooveshark.com" target="_blank">Grooveshark Lite</a> is now officially live.</p>
<p>Grooveshark Lite takes all the long-tail P2P musical goodness of Grooveshark.com and distills it in a handy quick interface to find and listen to whatever you want. Unlike the main Grooveshark site, you don&#8217;t have to have an account or install our Sharkbyte client in order to listen to music. However, signing up for an account (it&#8217;s super easy!) allows you to save playlists, and your login will work for both Lite and the main Grooveshark site.</p>
<p>We&#8217;re hoping that you&#8217;ll find Grooveshark Lite to be the easiest way to listen to whatever you can think of. </p>
<p>We have tons of things planned that didn&#8217;t quite make it into this iteration, so keep an eye out for exciting new features over the next few weeks. And if you have any comments, suggestions, ideas, wishlists, problems, or just want to say hi, drop us an email at feedback@grooveshark.com. Or you can leave me a comment here and I&#8217;ll do my best to answer you personally. </p>
<p>We just upgraded a few other systems at the same time, so if things are a little shaky, just give us a little time and things ought to smooth out.</p>
<p>I&#8217;d love to talk more about Grooveshark Lite, but I&#8217;ve been here at the office for over 18 hours straight now, trying to make sure my baby gets off the ground right, so I&#8217;m not entirely lucid anymore.</p>
<p>Enjoy the music!</p>
]]></content:encoded>
			<wfw:commentRss>http://thingsthatwork.net/index.php/2008/04/15/welcome-to-grooveshark-lite/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Flex and Fonts</title>
		<link>http://thingsthatwork.net/index.php/2008/04/15/flex-and-fonts/</link>
		<comments>http://thingsthatwork.net/index.php/2008/04/15/flex-and-fonts/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 10:34:28 +0000</pubDate>
		<dc:creator>Katy Richard</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Fonts]]></category>

		<guid isPermaLink="false">http://thingsthatwork.net/index.php/2008/04/15/flex-and-fonts/</guid>
		<description><![CDATA[This was extremely frustrating, so I&#8217;m posting in the hopes that I can save others the same frustration.
So as you may know from my recent posts, I&#8217;ve been working on a huge Flex app for Grooveshark. We&#8217;re getting ready to launch it (probably in the next few hours actually), and our lead designer John and [...]]]></description>
			<content:encoded><![CDATA[<p>This was extremely frustrating, so I&#8217;m posting in the hopes that I can save others the same frustration.</p>
<p>So as you may know from my recent posts, I&#8217;ve been working on a huge Flex app for Grooveshark. We&#8217;re getting ready to launch it (probably in the next few hours actually), and our lead designer <a href="http://ashenden.tumblr.com/" target="_blank">John</a> and I were going through the app for some final visual tweaks. Button labels and input boxes were lovingly pushed a pixel here, a pixel there, until they looked just right.</p>
<p>Then we saw the app on Linux. It looked HORRIBLE. Half the text was far too low. You couldn&#8217;t even see the tails on letters like &#8216;g&#8217; and &#8216;y&#8217;. Suspicious, we checked it on a Windows machine. The text was also lower than on my Mac, though not as bad as on Linux. Windows only was only lower by about 4 pixels, Linux more like 10-15. I was baffled. Flash is Flash is Flash, right? The font was an embedded OpenType version of Helvetica that we bought just for this purpose. Why would the font render differently depending on the operating system?</p>
<p>I read about Flash&#8217;s different font managers, and thought perhaps the issue was that using an OpenType font forces the use of the AFEFontManager instead of the BatikFontManager. So I tried embedding a TrueType font instead, but it made no difference. The text was still just as skewed in Linux and Windows as it was before.</p>
<p>Eventually I found this <a href="http://visualrinse.com/2007/09/10/fixed-my-flex-font-woes-with-flash/" target="_blank">blog post</a> and decided that embedding the font via SWF was worth a try. I had originally decided to embed via a font file instead of swf because swf seemed to add more bulk to the compiled app, and honestly, this app is already huge.</p>
<p>Anyway, I embedded Helvetica via SWF instead of OpenType, and it worked! The application now renders identically cross-platform. So if anyone else out there is having trouble with cross-platform font rendering in Flex, try <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_09.html#251936" target="_blank">embedding your fonts via SWF</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://thingsthatwork.net/index.php/2008/04/15/flex-and-fonts/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Nearly there&#8230;</title>
		<link>http://thingsthatwork.net/index.php/2008/04/14/nearly-there/</link>
		<comments>http://thingsthatwork.net/index.php/2008/04/14/nearly-there/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 07:18:15 +0000</pubDate>
		<dc:creator>Katy Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Grooveshark]]></category>

		<guid isPermaLink="false">http://thingsthatwork.net/index.php/2008/04/14/nearly-there/</guid>
		<description><![CDATA[Just over 1 Month&#8230;
Average of 67.5 hours a week&#8230;
Over 21,000 lines of MXML and Actionscript 3&#8230;

Me and Jay have been working our asses off for the last month, and all that effort is about to pay off. I&#8217;m going to sleep for days&#8230;
]]></description>
			<content:encoded><![CDATA[<p>Just over 1 Month&#8230;</p>
<p>Average of 67.5 hours a week&#8230;</p>
<p>Over 21,000 lines of MXML and Actionscript 3&#8230;</p>
<p><img src="http://thingsthatwork.net/images/posts/gslite_prev.png" alt="Grooveshark Lite preview" /></p>
<p>Me and <a href="http://wanderr.com/jay/">Jay</a> have been working our asses off for the last month, and all that effort is about to pay off. I&#8217;m going to sleep for days&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://thingsthatwork.net/index.php/2008/04/14/nearly-there/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FINALLY got Flex Builder and SVN to play nice</title>
		<link>http://thingsthatwork.net/index.php/2008/03/07/finally-got-flex-builder-and-svn-to-play-nice/</link>
		<comments>http://thingsthatwork.net/index.php/2008/03/07/finally-got-flex-builder-and-svn-to-play-nice/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 12:45:21 +0000</pubDate>
		<dc:creator>Katy Richard</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Grooveshark]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Flex Builder]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[Subclipse]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://thingsthatwork.net/index.php/2008/03/07/finally-got-flex-builder-and-svn-to-play-nice/</guid>
		<description><![CDATA[So for the longest time (a few months now), I had *not* been able to get Flex Builder to play nicely with version control. At Grooveshark we use Subversion.
First, naively, I tried just committing the whole project folder to the repo. Then I realized all the various hidden files that Eclipse makes (like .project, etc) [...]]]></description>
			<content:encoded><![CDATA[<p>So for the longest time (a few months now), I had *not* been able to get Flex Builder to play nicely with version control. At <a href="http://grooveshark.com" target="_blank">Grooveshark</a> we use Subversion.</p>
<p>First, naively, I tried just committing the whole project folder to the repo. Then I realized all the various hidden files that Eclipse makes (like .project, etc) would also be committed, and if any other developers also starting committing work, we&#8217;d break each others projects every time one of us updated after the other committed. </p>
<p>So then I committed only the /source folder where the actual code lives. However, then all the hidden .svn folders that SVN created showed up in the tree view of Flex Builder&#8217;s Navigator. I could ignore that, except it also completely broke Flex&#8217;s code hinting, Outline view said nothing but <span style="color:red;">! Root</span>, and Design mode (which I almost never use, but still&#8230;) would say nothing but, &#8220;An unknown item is declared as the root of your MXML document. Switch to source mode to correct it.&#8221; </p>
<p>Looking up the Design mode error on Google found a lot of people mentioning it, but no real solutions, except really stupid stuff like, &#8216;delete all the whitespace in your code.&#8217; (Which, when I tried it on a small test project, surprisingly did work, until you closed Flex Builder and opened it again. Then you&#8217;d have to delete all your whitespace all over again. Obviously, this is NOT a viable solution.) </p>
<p>The only solution I found that looked promising was to install Subclipse into Flex Builder, and create a new project by checking the code out from the repository. So I went about trying to install Subclipse. </p>
<p><span id="more-10"></span>At the time, I was using Flex Builder 2, for OS X. I&#8217;d never used Eclipse before I started using Flex Builder, and I have the stand-alone Flex Builder, not the Eclipse plugin. Everything I read about Subclipse seemed to imply that it required Tortoise SVN to work, which, as a Mac user, is obviously not an option. Now on the Subclipse site there is no mention of Tortoise. I don&#8217;t know if that&#8217;s something that&#8217;s changed in the past few months or not, cause I&#8217;m pretty sure I read all this on the official Subclipse site. Somewhere though, I remember reading that as long as I had the command-line svn client installed (I did) that it would still work for Mac. </p>
<p>I followed the instructions on the Subclipse site to install Subclipse, but whenever I got to the end, it would complain that I was missing some dependencies and that it could not install. I was not able to figure out exactly what dependencies I was missing, or where I could get them from, and I finally gave up.</p>
<p>I still needed version control, so instead I hacked together a little set of Automator scripts to help me get the job done. I had two copies of the /source folder for my Flex project: one was in the Flex project&#8217;s directory (~/Documents/Flex Builder 3/Grooveshark Lite/source), and one in a separate directory that I have the rest of our repo checked out into for local testing (/Applications/MAMP/htdocs/GS/trunk/flex/Grooveshark Lite/source). My Automator apps copy the files from one to the other and vice versa, dropping a numbered backup into a separate folder, just in case I screw up. Then I can commit my files using SmartSVN. I could have written a bash script to do the same thing, but Automator lets me add a pretty little confirmation box, just in case I hit one by accident.</p>
<p>They look a little something like this:</p>
<p>Copy Flex to SVN<br />
<code><br />
Ask for Confirmation<br />
tar -cvf /Users/krichard/Documents/Backups/FlexToSVN.tar --backup=numbered /Applications/MAMP/htdocs/GS/trunk/flex/Grooveshark\ Lite/<br />
rsync -vrC --exclude=.DS_Store --delete /Users/krichard/Documents/Flex\ Builder\ 3/Grooveshark\ Lite/source/ /Applications/MAMP/htdocs/GS/trunk/flex/Grooveshark\ Lite/source/<br />
</code></p>
<p>Copy SVN to Flex<br />
<code><br />
Ask for Confirmation (Twice! If I accidentally overwrite the SVN directory, I can just delete and re-check out. If I accidentally overwrite the Flex Builder directory, I've lost work. The backups prevent any real damage, but still...)<br />
tar -cvf /Users/krichard/Documents/Backups/SVNToFlex.tar --backup=numbered /Users/krichard/Documents/Flex\ Builder\ 3/Grooveshark\ Lite/<br />
rsync -vrC --exclude=.DS_Store --delete /Applications/MAMP/htdocs/GS/trunk/flex/Grooveshark\ Lite/source/ /Users/krichard/Documents/Flex\ Builder\ 3/Grooveshark\ Lite/source/<br />
</code></p>
<p>The nice part about using rsync is that the -C automatically excludes the .svn folders from being passed around. I&#8217;m also excluding the .DS_Store files that OS X likes to stick everywhere.</p>
<p>So fast forward a few months: I&#8217;d switched from Flex Builder 2 to Flex Builder 3, and was still using my Automator scripts. Today I was setting up Subversion on my Slice for a personal project I&#8217;m about to start working on. I *really* didn&#8217;t feel like writing another set of Automator scripts for this new project, especially as sometimes I&#8217;ll be working on it on my off hours at the office (so I can use the huge widescreen monitor), and sometimes just at home on my iBook. So I decided to give Flex Builder and SVN another shot.</p>
<p>Well, I still had all the same problems. However, this time my searching came up with a link to <a href="http://www-128.ibm.com/developerworks/opensource/library/os-ecl-subversion/" target="_blank">this article</a>. I noticed the screenshots were obviously OS X, not Windows, and felt a sliver of hope.</p>
<p>I followed the instructions, and no errors this time! No complaining about dependencies. Everything installed just fine. I&#8217;m not sure what to attribute to the difference in my experience from a couple months ago. Is it a new version of Subclipse? Is it because I had Flex Builder 3 instead of 2? Were these instructions just flat out better than the ones I read before on Subclipse&#8217;s own site? </p>
<p>So now I had Subclipse installed. Getting to the import process was slightly different than in the given instructions, I assume because I&#8217;m using the stand-alone Flex Builder and not the plugin. Instead of just choosing File -> Import -> Checkout projects from SVN, I had to choose File -> Import -> Other -> Other (Yes, that&#8217;s two Others, not a typo) -> Checkout projects from SVN. </p>
<p>And&#8230; it worked! It checked out my folders, and I was able to commit changes with no problems. My code hinting still works. I backed up my Grooveshark Lite files, deleted the project, and checked it out as a new project from the Grooveshark repo too. Everything in that project is working fine as well. Bye-bye Automator scripts!</p>
<p>So for anyone out there who has tried in vain to get Flex Builder working with Subclipse on OS X, try the instructions at<a href=" http://www-128.ibm.com/developerworks/opensource/library/os-ecl-subversion/" target="_blank"> http://www-128.ibm.com/developerworks/opensource/library/os-ecl-subversion/</a> with Flex Builder 3. Hopefully you&#8217;ll be as pleasantly surprised as I was.</p>
]]></content:encoded>
			<wfw:commentRss>http://thingsthatwork.net/index.php/2008/03/07/finally-got-flex-builder-and-svn-to-play-nice/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
