<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Destroy Today</title>
	
	<link>http://destroytoday.com/blog</link>
	<description>Jonnie is back to work.</description>
	<lastBuildDate>Tue, 02 Feb 2010 18:12:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/destroytoday" /><feedburner:info uri="destroytoday" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Intro to Dwarf</title>
		<link>http://feedproxy.google.com/~r/destroytoday/~3/J5qdcxd8r6I/</link>
		<comments>http://destroytoday.com/blog/2010/02/intro-to-dwarf/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 18:12:43 +0000</pubDate>
		<dc:creator>Jonnie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Dwarf]]></category>
		<category><![CDATA[Screencast]]></category>

		<guid isPermaLink="false">http://destroytoday.com/blog/?p=1722</guid>
		<description><![CDATA[
I&#8217;ve been working on Dwarf over the past few days and decided it&#8217;s time to give a little introduction on its key features. Be sure to view fullscreen with no scaling to see it at 100%. The prerelease of Dwarf available to download on GitHub and the source code is hosted there as well. I&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="645" height="363" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=9159573&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=007998&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="645" height="363" src="http://vimeo.com/moogaloop.swf?clip_id=9159573&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=007998&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>I&#8217;ve been working on Dwarf over the past few days and decided it&#8217;s time to give a little introduction on its key features. Be sure to view fullscreen with no scaling to see it at 100%. The prerelease of Dwarf available to <a href="http://github.com/destroytoday/Dwarf/downloads" target="_blank">download</a> on GitHub and the <a href="http://github.com/destroytoday/Dwarf" target="_blank">source code</a> is hosted there as well. I&#8217;ll be rolling out the official 1.0 build pretty soon—I just need to add a few more key features.</p>
<img src="http://feeds.feedburner.com/~r/destroytoday/~4/J5qdcxd8r6I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://destroytoday.com/blog/2010/02/intro-to-dwarf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://destroytoday.com/blog/2010/02/intro-to-dwarf/</feedburner:origLink></item>
		<item>
		<title>Dwarf gets new life and is now open source</title>
		<link>http://feedproxy.google.com/~r/destroytoday/~3/jfBJQ-Is2MQ/</link>
		<comments>http://destroytoday.com/blog/2010/01/dwarf-gets-new-life-and-is-now-open-source/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 16:18:30 +0000</pubDate>
		<dc:creator>Jonnie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Announcement]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Dwarf]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://destroytoday.com/blog/?p=1716</guid>
		<description><![CDATA[
A recent AIR prerelease drop broke Dwarf. I&#8217;m actually not surprised, since it uses a pretty ghetto hack—displaying a transparent window fullscreen and using &#8216;virtual&#8217; windows. Because Dwarf is such an integral part of my everyday workflow and it&#8217;s such a small app, I figured I could easily rewrite it within a day or two. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1717" title="Dwarf on Git" src="http://destroytoday.com/blog/wp-content/uploads/2010/01/dwarf_on_git.gif" alt="Dwarf on Git" width="645" height="430" /></p>
<p>A recent AIR prerelease drop broke Dwarf. I&#8217;m actually not surprised, since it uses a pretty ghetto hack—displaying a transparent window fullscreen and using &#8216;virtual&#8217; windows. Because Dwarf is such an integral part of my everyday workflow and it&#8217;s such a small app, I figured I could easily rewrite it within a day or two. I&#8217;ve been on such a code-sharing high, that I started <a href="http://github.com/destroytoday/Dwarf" target="_blank">a new Git repository for it</a> where you can find my work in progress. So far, I have a single ruler working with a semi-functional Mac toolbar. Everything should be complete either tonight or tomorrow, so keep an eye out.</p>
<p>On a legal note, the source code is provided under the <a href="http://github.com/destroytoday/Dwarf/blob/master/README" target="_blank">GNU General Public License (GPL)</a>, so you can reuse and modify the code all you want as long as it&#8217;s still free. If you&#8217;d like to use it for commercial purposes, let&#8217;s talk.</p>
<img src="http://feeds.feedburner.com/~r/destroytoday/~4/jfBJQ-Is2MQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://destroytoday.com/blog/2010/01/dwarf-gets-new-life-and-is-now-open-source/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://destroytoday.com/blog/2010/01/dwarf-gets-new-life-and-is-now-open-source/</feedburner:origLink></item>
		<item>
		<title>Luke Williams of LukeLukeLuke.com launches a weblog</title>
		<link>http://feedproxy.google.com/~r/destroytoday/~3/0yoh4PKuMnk/</link>
		<comments>http://destroytoday.com/blog/2010/01/luke-williams-of-lukelukeluke-com-launches-a-weblog/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 03:03:46 +0000</pubDate>
		<dc:creator>Jonnie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Photography]]></category>

		<guid isPermaLink="false">http://destroytoday.com/blog/?p=1713</guid>
		<description><![CDATA[
My good friend, Luke Williams, finally launched his weblog—yes, I used the full word. Even though it has only been live for a short time, he already has a solid amount of fresh content. I know Luke is determined to keep this one active—as opposed to his first attempt, which ended up being comment-spammed by [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lukelukeluke.com/blog/"><img class="alignnone size-full wp-image-1714" title="lukelukeluke_blog" src="http://destroytoday.com/blog/wp-content/uploads/2010/01/lukelukeluke_blog.jpg" alt="lukelukeluke_blog" width="645" height="426" /></a></p>
<p>My good friend, <a href="http://lukelukeluke.com" target="_blank">Luke Williams</a>, finally launched his <a href="http://lukelukeluke.com/blog" target="_blank">weblog</a>—yes, I used the full word. Even though it has only been live for a short time, he already has a solid amount of fresh content. I know Luke is determined to keep this one active—as opposed to his first attempt, which ended up being comment-spammed by myself impersonating some of the more interesting people from MICA. Check it out and let him know what you think.</p>
<img src="http://feeds.feedburner.com/~r/destroytoday/~4/0yoh4PKuMnk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://destroytoday.com/blog/2010/01/luke-williams-of-lukelukeluke-com-launches-a-weblog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://destroytoday.com/blog/2010/01/luke-williams-of-lukelukeluke-com-launches-a-weblog/</feedburner:origLink></item>
		<item>
		<title>EventMap.mapListener bug (and fix!) in RobotLegs</title>
		<link>http://feedproxy.google.com/~r/destroytoday/~3/p-hBoRoqzi8/</link>
		<comments>http://destroytoday.com/blog/2010/01/eventmap-maplistener-bug-and-fix-in-robotlegs/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 02:38:31 +0000</pubDate>
		<dc:creator>Jonnie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Quick Fix]]></category>

		<guid isPermaLink="false">http://destroytoday.com/blog/?p=1708</guid>
		<description><![CDATA[This past week, I experienced a bug with RobotLegs where the EventMap.mapListener method would add the listener multiple times if called multiple times. Yesterday, I had some free time to dig a little deeper and managed to pinpoint the problematic code. It turns out the method didn&#8217;t check to see if the listener existed prior [...]]]></description>
			<content:encoded><![CDATA[<p>This past week, I experienced a bug with <a href="http://robotlegs.org/" target="_blank">RobotLegs</a> where the <em>EventMap.mapListener</em> method would add the listener multiple times if called multiple times. Yesterday, I had some free time to dig a little deeper and managed to pinpoint the problematic code. It turns out the method didn&#8217;t check to see if the listener existed prior to adding to the array. This explains why a button click handler in my code would respond twice.</p>
<p>Thanks to the oh-so-wonderful <a href="http://github.com" target="_blank">GitHub</a>, I was able to fork the repository, implement the fix, write a unit test to verify it&#8217;s safe, and find in the morning that it has been integrated into the actual <a href="http://github.com/robotlegs/robotlegs-framework" target="_blank">RobotLegs repository</a>—just like that. If you experienced the bug, be sure to pull the latest commit.</p>
<p>Now, if you&#8217;re not on GitHub, do yourself a favor and join today. In the few months I&#8217;ve been a member, I&#8217;ve met a handful of incredible developers and now feel compelled to share code when I can. Everyone benefits when you share what you know.</p>
<img src="http://feeds.feedburner.com/~r/destroytoday/~4/p-hBoRoqzi8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://destroytoday.com/blog/2010/01/eventmap-maplistener-bug-and-fix-in-robotlegs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://destroytoday.com/blog/2010/01/eventmap-maplistener-bug-and-fix-in-robotlegs/</feedburner:origLink></item>
		<item>
		<title>Introducing TwitterAspirin: an AS3 Twitter API painkiller</title>
		<link>http://feedproxy.google.com/~r/destroytoday/~3/NicmUyb-aA4/</link>
		<comments>http://destroytoday.com/blog/2010/01/introducing-twitteraspirin-an-as3-twitter-api-painkiller/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 15:01:58 +0000</pubDate>
		<dc:creator>Jonnie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Announcement]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[DestroyTwitter]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://destroytoday.com/blog/?p=1704</guid>
		<description><![CDATA[A couple months ago, I started working on a Twitter component for my current project at Adobe. I went into this knowing I&#8217;d have to finally face the beast&#8230; OAuth. Just about every well-known Twitter client out there uses Basic Auth—and for a reason. It&#8217;s easy, what the user expects, and gives your app more [...]]]></description>
			<content:encoded><![CDATA[<p>A couple months ago, I started working on a Twitter component for my current project at Adobe. I went into this knowing I&#8217;d have to finally face the beast&#8230; OAuth. Just about every well-known Twitter client out there uses Basic Auth—and for a reason. It&#8217;s easy, what the user expects, and gives your app more credibility—there&#8217;s no requirement to leave to authenticate through the browser like with OAuth.</p>
<p>About five or six months ago, Twitter decided to enforce the transition. From then on, any application that uses the API must use OAuth in order to see &#8220;via [your app]&#8221; on tweets published with it—otherwise, it would display &#8220;via API.&#8221; Since &#8220;via&#8221; is where apps get probably 90% of their referrals, this was a big deal. Luckily for me, <a href="http://destroytwitter.com" target="_blank">DestroyTwitter</a> existed before that time and Twitter decided not to push the change on the veteran apps. Recently, however, the bad news spread that Basic Auth would be deprecated in June. This means every Twitter app must transition to the pain that is OAuth.</p>
<p>After developing the <a href="http://destroytoday.com/blog/2009/10/adobe-max-companion-launched/" target="_blank">MAX Companion</a> this past fall and now the more generalized version, I found myself rewriting the Twitter component each time. After a while, the Twitter API code I wrote for DestroyTwitter began to merge with the actual implementation, so it was no longer a standalone library that could easily be used by other projects. These past few months, I&#8217;ve been learning a great deal about framework architecture and design patterns. It has led me to realize I need to start fresh.</p>
<p>With all that being said, I&#8217;d like introduce a library I started working on two days ago. I call it <a href="http://github.com/destroytoday/TwitterAspirin" target="_blank">TwitterAspirin</a>. It&#8217;s an AS3 Twitter API library that eases the pain, providing developers with a very powerful tool for communicating with Twitter. Though it&#8217;s still a newborn at the moment, I see potential already. The library is built on <a href="http://robotlegs.org/" target="_blank">RobotLegs</a> and uses <a href="http://github.com/robertpenner/as3-signals" target="_blank">AS3 Signals</a> instead of events. It&#8217;s hosted on <a href="http://github.com" target="_blank">GitHub</a>, so the source code will always be available to the public. And, after last night&#8217;s commit, its OAuth functionality is complete. Here&#8217;s how to use it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0000FF;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0000FF;">import</span> com.destroytoday.twitteraspirin.Twitter;
&nbsp;
	<span style="color: #0000FF;">import</span> <span style="color: #000000;">flash.display</span>.<span style="color: #000000;">Sprite</span>;
&nbsp;
	<span style="color: #0000FF;">public</span> <span style="color: #0000FF;">class</span> Test extends <span style="color: #000000;">Sprite</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #FF0099;">// set application consumer key and secret</span>
		<span style="color: #0000FF;">public</span> <span style="color: #FF0000;">var</span> twitter<span style="color: #000000;">:</span>Twitter = <span style="color: #0000FF;">new</span> Twitter<span style="color: #000000;">&#40;</span>consumerKey, consumerSecret<span style="color: #000000;">&#41;</span>;
&nbsp;
		<span style="color: #0000FF;">public</span> <span style="color: #FF0000;">function</span> Test<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #FF0099;">// add signal listeners</span>
			twitter.oauth.requestTokenSignal.<span style="color: #FF0000;">add</span><span style="color: #000000;">&#40;</span>requestTokenHandler<span style="color: #000000;">&#41;</span>;
			twitter.oauth.accessTokenSignal.<span style="color: #FF0000;">add</span><span style="color: #000000;">&#40;</span>accessTokenHandler<span style="color: #000000;">&#41;</span>;
			twitter.oauth.verifyAccessTokenSignal.<span style="color: #FF0000;">add</span><span style="color: #000000;">&#40;</span>verifyAccessTokenHandler<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #FF0099;">// click the 'Authorize' button to get the request token</span>
		<span style="color: #0000FF;">protected</span> <span style="color: #FF0000;">function</span> authorizeClickHandler<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">:</span><span style="color: #0000FF;">void</span> <span style="color: #000000;">&#123;</span>
			twitter.oauth.getRequestToken<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #FF0099;">// upon receiving the request token, open Twitter in the browser to authorize</span>
		<span style="color: #0000FF;">protected</span> <span style="color: #FF0000;">function</span> requestTokenHandler<span style="color: #000000;">&#40;</span>oauth<span style="color: #000000;">:</span>OAuth, token<span style="color: #000000;">:</span>OAuthToken<span style="color: #000000;">&#41;</span><span style="color: #000000;">:</span><span style="color: #0000FF;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #FF0000;">navigateToURL</span><span style="color: #000000;">&#40;</span><span style="color: #0000FF;">new</span> <span style="color: #000000;">URLRequest</span><span style="color: #000000;">&#40;</span>oauth.getAuthorizeURL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #FF0099;">// return with the provided pin and click the 'Activate' button to get the access token</span>
		<span style="color: #0000FF;">protected</span> <span style="color: #FF0000;">function</span> activateClickHandler<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">:</span><span style="color: #0000FF;">void</span> <span style="color: #000000;">&#123;</span>
			twitter.oauth.getAccessToken<span style="color: #000000;">&#40;</span>pin<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #FF0099;">// upon receiving the access token, verify it</span>
		<span style="color: #0000FF;">protected</span> <span style="color: #FF0000;">function</span> accessTokenHandler<span style="color: #000000;">&#40;</span>oauth<span style="color: #000000;">:</span>OAuth, token<span style="color: #000000;">:</span>OAuthToken<span style="color: #000000;">&#41;</span><span style="color: #000000;">:</span><span style="color: #0000FF;">void</span> <span style="color: #000000;">&#123;</span>
			oauth.verifyAccessToken<span style="color: #000000;">&#40;</span>token<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #FF0099;">// done</span>
		<span style="color: #0000FF;">protected</span> <span style="color: #FF0000;">function</span> verifyAccessTokenHandler<span style="color: #000000;">&#40;</span>oauth<span style="color: #000000;">:</span>OAuth, token<span style="color: #000000;">:</span>OAuthToken<span style="color: #000000;">&#41;</span><span style="color: #000000;">:</span><span style="color: #0000FF;">void</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>As you can see, it&#8217;s extremely easy to use. Not only that, it provides great flexibility. Many libraries are simple to implement, but don&#8217;t allow the developer access to certain aspects of the process. With TwitterAspirin, each method returns the loader involved with the operation, giving developers the ability to listen for errors, cancel the operation, or attain the raw API data. The library also uses loader pools to recycle instances, so you can submit a tweet and, while it&#8217;s loading, submit another—you don&#8217;t have to wait for the first operation to finish. Then, once the operation is complete, the loader is disposed and returned to the pool, which optimizes performance and memory usage.</p>
<p>I&#8217;m really excited to see where TwitterAspirin goes and I have nothing but great expectations. Be sure to follow along with development and fork whenever you like.</p>
<img src="http://feeds.feedburner.com/~r/destroytoday/~4/NicmUyb-aA4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://destroytoday.com/blog/2010/01/introducing-twitteraspirin-an-as3-twitter-api-painkiller/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		<feedburner:origLink>http://destroytoday.com/blog/2010/01/introducing-twitteraspirin-an-as3-twitter-api-painkiller/</feedburner:origLink></item>
		<item>
		<title>Introducing the XMLLoader class</title>
		<link>http://feedproxy.google.com/~r/destroytoday/~3/nbrgP6q8pTo/</link>
		<comments>http://destroytoday.com/blog/2010/01/introducing-the-xmlloader-class/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 14:43:45 +0000</pubDate>
		<dc:creator>Jonnie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Announcement]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://destroytoday.com/blog/?p=1700</guid>
		<description><![CDATA[I started the XMLLoader class a few months back, but didn&#8217;t post right away because it needed a lot of cleanup. Not cleanup in the sense of performance improvement or refactoring—it simply used my old programming style, full of dollar signs and underscores. If anyone remembers seeing my code in that form, I deeply apologize [...]]]></description>
			<content:encoded><![CDATA[<p>I started the <a href="http://github.com/destroytoday/DestroyFramework/blob/master/src/com/destroytoday/net/XMLLoader.as" target="_blank">XMLLoader</a> class a few months back, but didn&#8217;t post right away because it needed a lot of cleanup. Not cleanup in the sense of performance improvement or refactoring—it simply used my old programming style, full of dollar signs and underscores. If anyone remembers seeing my code in that form, I deeply apologize for the pain it must have caused your eyes.</p>
<p>So why an <em>XMLLoader</em> class?—because 99% of the data I load with AS3/AIR is in XML format. I stay far from JSON when possible because in AS3 it&#8217;s slower than a slug on its day off. XML is native and uses E4X, which lets developers navigate its information just like you would an AS3 tree. I load XML so often, I found myself copying and pasting the same code each time I&#8217;d need it—this is the clearest indicator that a class must be written.</p>
<p>Parsing String data to XML poses an issue that many don&#8217;t know about. I only discovered it because of the Twitter API. The API is so janked, it sometimes returns the HTML error page instead of the XML response. It wouldn&#8217;t be so bad if it weren&#8217;t for an image tag in the HTML that isn&#8217;t closed. This immediately throws an &#8220;XML parser failure: element is malformed&#8221; error. Using try/catch is the only way to avoid this. That&#8217;s why I wrote it into <em>XMLLoader</em>. It automatically handles the data, attempts to parse it, and, if there are any errors, the load stops and dispatches an error signal.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0000FF;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0000FF;">import</span> com.destroytoday.net.XMLLoader;
&nbsp;
	<span style="color: #0000FF;">import</span> <span style="color: #000000;">flash.display</span>.<span style="color: #000000;">Sprite</span>;
&nbsp;
	<span style="color: #0000FF;">public</span> <span style="color: #0000FF;">class</span> Test extends <span style="color: #000000;">Sprite</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #0000FF;">public</span> <span style="color: #FF0000;">var</span> <span style="color: #FF0000;">loader</span><span style="color: #000000;">:</span>XMLLoader;
&nbsp;
		<span style="color: #0000FF;">public</span> <span style="color: #FF0000;">function</span> Test<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #FF0000;">loader</span> = <span style="color: #0000FF;">new</span> XMLLoader<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #FF0000;">loader</span>.retryCount = <span style="color: #000000;">2</span>;
			<span style="color: #FF0000;">loader</span>.includeResponseInfo = <span style="color: #0000FF;">true</span>;
&nbsp;
			<span style="color: #FF0000;">loader</span>.openSignal.<span style="color: #FF0000;">add</span><span style="color: #000000;">&#40;</span>loaderOpenHandler<span style="color: #000000;">&#41;</span>;
			<span style="color: #FF0000;">loader</span>.completeSignal.<span style="color: #FF0000;">add</span><span style="color: #000000;">&#40;</span>loaderCompleteHandler<span style="color: #000000;">&#41;</span>;
			<span style="color: #FF0000;">loader</span>.errorSignal.<span style="color: #FF0000;">add</span><span style="color: #000000;">&#40;</span>loaderErrorHandler<span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #FF0000;">loader</span>.<span style="color: #FF0000;">load</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;http://search.twitter.com/search.atom?q=destroytoday&quot;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0000FF;">protected</span> <span style="color: #FF0000;">function</span> loaderOpenHandler<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">loader</span><span style="color: #000000;">:</span>XMLLoader<span style="color: #000000;">&#41;</span><span style="color: #000000;">:</span><span style="color: #0000FF;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #FF0000;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">loader</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0000FF;">protected</span> <span style="color: #FF0000;">function</span> loaderCompleteHandler<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">loader</span><span style="color: #000000;">:</span>XMLLoader, <span style="color: #FF0000;">data</span><span style="color: #000000;">:</span><span style="color: #000000;">XML</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">:</span><span style="color: #0000FF;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #FF0000;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">loader</span>, <span style="color: #FF0000;">data</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0000FF;">protected</span> <span style="color: #FF0000;">function</span> loaderErrorHandler<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">loader</span><span style="color: #000000;">:</span>XMLLoader, <span style="color: #FF0000;">error</span><span style="color: #000000;">:</span><span style="color: #000000;">String</span>, <span style="color: #FF0000;">message</span><span style="color: #000000;">:</span><span style="color: #000000;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">:</span><span style="color: #0000FF;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #FF0000;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">loader</span>, <span style="color: #FF0000;">error</span>, <span style="color: #FF0000;">message</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #FF0000;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">loader</span>.responseStatus<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Speaking of signals, <em>XMLLoader</em> is the first class in <a href="http://github.com/destroytoday/DestroyFramework" target="_blank">DestroyFramework</a> to use <a href="http://robertpenner.com/flashblog/" target="_blank">Robert Penner&#8217;s</a> <a href="http://github.com/robertpenner/as3-signals" target="_blank">AS3 Signals</a> instead of events. If you have to ask why, you haven&#8217;t been programming in AS3 long enough. Each <em>XMLLoader</em> instance has signals for <em>open</em>, <em>complete</em>, <em>error</em>, and <em>cancel</em>. The class also includes a <em>retryCount</em> property that indicates how many times to attempt to load a URL before calling it quits. Since some APIs can be down one second, then up the next, this feature really comes in handy. It&#8217;s mainly intended for handling the beloved fail whale.</p>
<p>The last two features include a <em>cancel</em> method and an <em>includeResponseInfo</em> property. Sure, <em>URLLoader</em> has a cancel method, <em>close</em>, but an exception is thrown if you call <em>close</em> when no operation is in progress. This makes sense, but the runtime shouldn&#8217;t close down shop when it happens. <em>XMLLoader</em> instead cancels and dispatches the <em>cancel</em> signal when the cancel method is called, and if no operations are in progress, it simply does nothing.</p>
<p>The <em>includeResponseInfo</em> property is an incredibly easy way to tell the loader to return the response status code and headers upon success or fail. Without <em>XMLLoader</em>, you could get this information with an event listener and the appropriate handler, but it&#8217;s far easier to flick a switch. In all honesty, I&#8217;ve neglected to retrieve this info using <em>URLLoader</em> in the past simply because it&#8217;s such a verbose process. Now that it only requires setting the property to <em>true</em>, I know I&#8217;ll use it more often than not.</p>
<p>As always, the <a href="http://github.com/destroytoday/DestroyFramework/blob/master/src/com/destroytoday/net/XMLLoader.as" target="_blank">source code</a> is available on <a href="http://github.com" target="_blank">GitHub</a>. Be sure to keep watch—my account will be pretty active these next few weeks.</p>
<img src="http://feeds.feedburner.com/~r/destroytoday/~4/nbrgP6q8pTo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://destroytoday.com/blog/2010/01/introducing-the-xmlloader-class/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://destroytoday.com/blog/2010/01/introducing-the-xmlloader-class/</feedburner:origLink></item>
		<item>
		<title>‘Undocumented feature’ in Rob Penner’s AS3 Signals</title>
		<link>http://feedproxy.google.com/~r/destroytoday/~3/Euz3pt-LSCA/</link>
		<comments>http://destroytoday.com/blog/2010/01/undocumented-feature-in-rob-penners-as3-signals/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 01:00:51 +0000</pubDate>
		<dc:creator>Jonnie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Quick Fix]]></category>

		<guid isPermaLink="false">http://destroytoday.com/blog/?p=1695</guid>
		<description><![CDATA[
Last week, I started replacing events in DestroyFramework with Rob Penner&#8217;s AS3 Signals. They&#8217;re faster, shorter, and include a few methods that developers have been dying for. Unfortunately, the first implementation, into my new Group class, didn&#8217;t work. I was puzzled to say the least. After literally hours of testing and debugging, I discovered the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/destroytoday/as3-signals/commit/7112fd8da90205ec3a36642dcfef4293df94629f"><img class="alignnone size-full wp-image-1696" title="bug_feature" src="http://destroytoday.com/blog/wp-content/uploads/2010/01/bug_feature.jpg" alt="bug_feature" width="645" height="385" /></a></p>
<p>Last week, I started replacing events in <a href="http://github.com/destroytoday/DestroyFramework" target="_blank">DestroyFramework</a> with <a href="http://robertpenner.com/flashblog/" target="_blank">Rob Penner&#8217;s</a> <a href="http://github.com/robertpenner/as3-signals" target="_blank">AS3 Signals</a>. They&#8217;re faster, shorter, and include a few methods that developers have been dying for. Unfortunately, the first implementation, into my new Group class, didn&#8217;t work. I was puzzled to say the least. After literally hours of testing and debugging, I discovered the culprit.</p>
<p>It turns out, the <em>remove(listener)</em> method lacks a check for listener existence in the listeners array. When the method is called, if the index of the listener returns -1, the array splices the first listener. I forked the Git repository and <a href="http://github.com/destroytoday/as3-signals/commit/7112fd8da90205ec3a36642dcfef4293df94629f" target="_blank">implemented the fix</a> on the <em>Signal</em>, <em>NativeSignal</em>, and <em>DeluxeSignal</em> classes. And because a fix isn&#8217;t a fix without proper unit testing (says <a href="http://joelhooks.com/" target="_blank">Joel Hooks</a>), I <a href="http://github.com/destroytoday/as3-signals/commit/22bdeb2c629b6c1af25f9bb76a64d37893fbc362" target="_blank">added the unit tests</a> as well.</p>
<img src="http://feeds.feedburner.com/~r/destroytoday/~4/Euz3pt-LSCA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://destroytoday.com/blog/2010/01/undocumented-feature-in-rob-penners-as3-signals/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://destroytoday.com/blog/2010/01/undocumented-feature-in-rob-penners-as3-signals/</feedburner:origLink></item>
		<item>
		<title>Getting back into the swing of things</title>
		<link>http://feedproxy.google.com/~r/destroytoday/~3/XURjw9dbPJU/</link>
		<comments>http://destroytoday.com/blog/2010/01/getting-back-into-the-swing-of-things/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 16:38:27 +0000</pubDate>
		<dc:creator>Jonnie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Announcement]]></category>
		<category><![CDATA[Future]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://destroytoday.com/blog/?p=1688</guid>
		<description><![CDATA[It&#8217;s been a solid 17 days since I started Destroy Everyday—the creation-a-day mini blog aimed to balance my life between coding and off-the-computer mediums. So far, it&#8217;s been a success, meaning I have yet to miss a day. It&#8217;s been such a personal success that I&#8217;ve somewhat neglected the mothership—Destroy Today. Now that I have [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a solid 17 days since I started <a href="http://destroyeveryday.com" target="_blank">Destroy Everyday</a>—the creation-a-day mini blog aimed to balance my life between coding and off-the-computer mediums. So far, it&#8217;s been a success, meaning I have yet to miss a day. It&#8217;s been such a personal success that I&#8217;ve somewhat neglected the mothership—Destroy Today. Now that I have a solid routine down for the new year, it&#8217;s time to get back to business and stay active across the board.</p>
<p>I have a number of new <a href="http://github.com/destroytoday/DestroyFramework" target="_blank">DestroyFramework</a> classes ready to document and check-in over the next few days. I plan to get back into sharing interesting and useful things I come across, regarding both programming and design. And, now that I&#8217;ve been introduced to MVC(S) and <a href="http://robotlegs.org/" target="_blank">RobotLegs</a>, I have a lot more to talk about—expect a tutorial in the near future.</p>
<p>To add some imagery to this post, below is yesterday&#8217;s Destroy Everyday post featuring <a href="http://andymangold.com" target="_blank">Andy Mangold</a>. I also included a detail shot because the web-sized image really doesn&#8217;t do it justice.</p>
<p><a href="http://destroyeveryday.com"><img class="alignnone size-full wp-image-1690" title="andy" src="http://destroytoday.com/blog/wp-content/uploads/2010/01/andy.jpg" alt="andy" width="645" height="451" /></a></p>
<p><a href="http://destroyeveryday.com"><img class="alignnone size-full wp-image-1689" title="andy_detail" src="http://destroytoday.com/blog/wp-content/uploads/2010/01/andy_detail.jpg" alt="andy_detail" width="645" height="509" /></a></p>
<img src="http://feeds.feedburner.com/~r/destroytoday/~4/XURjw9dbPJU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://destroytoday.com/blog/2010/01/getting-back-into-the-swing-of-things/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://destroytoday.com/blog/2010/01/getting-back-into-the-swing-of-things/</feedburner:origLink></item>
		<item>
		<title>2010 is destroyeveryday.com</title>
		<link>http://feedproxy.google.com/~r/destroytoday/~3/w0dnv92DagY/</link>
		<comments>http://destroytoday.com/blog/2010/01/2010-is-destroyeveryday-com/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 02:58:40 +0000</pubDate>
		<dc:creator>Jonnie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Announcement]]></category>
		<category><![CDATA[Photography]]></category>

		<guid isPermaLink="false">http://destroytoday.com/blog/?p=1679</guid>
		<description><![CDATA[
It&#8217;s the new year and the best day to start anything. In my search for a hobby off the computer, I compromised and found a semi-off-the-computer challenge. Jen led me to the &#8220;Make Something Cool Every Day&#8221; concept. It&#8217;s a great motivation to consistently produce work while strengthening creativity. The best example I&#8217;ve seen yet [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://destroyeveryday.com"><img class="alignnone size-full wp-image-1680" title="destroyeveryday.com" src="http://destroytoday.com/blog/wp-content/uploads/2010/01/2010_01_01.jpg" alt="destroyeveryday.com" width="645" height="293" /></a></p>
<p>It&#8217;s the new year and the best day to start anything. In my search for a hobby off the computer, I compromised and found a semi-off-the-computer challenge. Jen led me to the &#8220;Make Something Cool Every Day&#8221; concept. It&#8217;s a great motivation to consistently produce work while strengthening creativity. The best example I&#8217;ve seen yet is <a href="http://www.behance.net/Gallery/Make-Something-Cool-Every-Day-2009/171640" target="_blank">Brock Davis&#8217;s portfolio</a> on <a href="http://behance.net" target="_blank">Behance</a>. Surely, I don&#8217;t expect to think up ideas as original as his, but I plan to use this as a stimulus to return to photography, print, and any other physical mediums I&#8217;ve neglected over the years.</p>
<p>The daily creations will reside on <a href="http://destroyeveryday.com" target="_blank">destroyeveryday.com</a> as a <a href="http://tumblr.com" target="_blank">Tumblr</a> blog. The service provides a dozen different ways to post content, so &#8220;I didn&#8217;t have access to a computer&#8221; won&#8217;t be an excuse for missing a day—believe it or not, you can post content via a 1-800 number. Here&#8217;s to the new year and the beginning of a new venture.</p>
<img src="http://feeds.feedburner.com/~r/destroytoday/~4/w0dnv92DagY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://destroytoday.com/blog/2010/01/2010-is-destroyeveryday-com/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://destroytoday.com/blog/2010/01/2010-is-destroyeveryday-com/</feedburner:origLink></item>
		<item>
		<title>Where to find the right fontName</title>
		<link>http://feedproxy.google.com/~r/destroytoday/~3/s6fkT1SFncc/</link>
		<comments>http://destroytoday.com/blog/2009/12/where-to-find-the-right-fontname/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 01:54:11 +0000</pubDate>
		<dc:creator>Jonnie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Quick Fix]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://destroytoday.com/blog/?p=1669</guid>
		<description><![CDATA[To preface, I embed fonts using the Embed metatag and fontName parameter with an SWF as the source. If you&#8217;re unfamiliar with this method, it looks like this:

1
2
&#91;Embed&#40;source=&#34;assets/fonts.swf&#34;, fontName=&#34;Helvetica&#34;&#41;&#93;
protected static const HELVETICA:String;

This past week, I came across the same issue twice. Up until now, I only worked with fonts that used the fontName as it [...]]]></description>
			<content:encoded><![CDATA[<p>To preface, I embed fonts using the <em>Embed</em> metatag and <em>fontName</em> parameter with an SWF as the source. If you&#8217;re unfamiliar with this method, it looks like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">source</span>=<span style="color: #666666;">&quot;assets/fonts.swf&quot;</span>, <span style="color: #FF0000;">fontName</span>=<span style="color: #666666;">&quot;Helvetica&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0000FF;">protected</span> static const HELVETICA<span style="color: #000000;">:</span><span style="color: #000000;">String</span>;</pre></td></tr></table></div>

<p>This past week, I came across the same issue twice. Up until now, I only worked with fonts that used the <em>fontName</em> as it appears in Flash&#8217;s properties panel. Sure, this works for fonts with simple names, but when you start getting fancy, things get messy. I needed to embed Alternate Gothic No. 2 and Flash labeled it as &#8220;AlternateGothic&#8221; with &#8220;No2&#8243; as the style. I set the <em>fontName</em> as &#8220;AlternateGothic No2&#8243; and was presented with this familiar gem:</p>
<p><img src="http://destroytoday.com/blog/wp-content/uploads/2009/12/fontname_error.gif" alt="fontname_error" title="fontname_error" width="645" height="236" class="alignnone size-full wp-image-1670" /></p>
<p>I get shivers each time I see it. After a few minutes of failed guess and check, I set out for a solution. I opened FontExplorer X and discovered that the font is labeled as &#8220;AlternateGothic-No2&#8243;.I gave it a shot and boom went the dynamite. From then on, I thought that would be the correct fontName—the font&#8217;s label in Font Explorer X.</p>
<p><img src="http://destroytoday.com/blog/wp-content/uploads/2009/12/fontname_fontexplorer.gif" alt="fontname_fontexplorer" title="fontname_fontexplorer" width="645" height="113" class="alignnone size-full wp-image-1676" /></p>
<p>I was wrong. This week, I needed to embed Helvetica Neue Roman, which is labeled as &#8220;12 pt Helvetica* 55 Roman 05472&#8243; in FontExplorer X—freaky, eh? I tried it out and the error returned. At first, I was bummed because I thought I had a foolproof solution. I was close, but no cigar. I opened Font Book to get a second opinion. Apparently, the font&#8217;s true name is &#8220;12 pt Helvetica* 55 Roman   05472&#8243;, which means FontExplorer X removes redundant whitespace, found in our example between &#8220;Roman&#8221; and &#8220;05472.&#8221; I tried it out and, sweet sassy molassy, it worked.</p>
<p><img src="http://destroytoday.com/blog/wp-content/uploads/2009/12/fontname_fontbook.gif" alt="fontname_fontbook" title="fontname_fontbook" width="645" height="188" class="alignnone size-full wp-image-1673" /></p>
<p>From now on, I&#8217;ll consult Font Book when embedding a new font.</p>
<img src="http://feeds.feedburner.com/~r/destroytoday/~4/s6fkT1SFncc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://destroytoday.com/blog/2009/12/where-to-find-the-right-fontname/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://destroytoday.com/blog/2009/12/where-to-find-the-right-fontname/</feedburner:origLink></item>
	</channel>
</rss>
