<?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>The Nordhagen &#187; Adobe Flash</title>
	<atom:link href="http://www.oyvindnordhagen.com/blog/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.oyvindnordhagen.com/blog</link>
	<description>Øyvind Nordhagen on ActionScript and other things</description>
	<lastBuildDate>Wed, 08 Sep 2010 09:25:28 +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>Olog 1.2 is released</title>
		<link>http://www.oyvindnordhagen.com/blog/2010/09/08/olog-1-2-is-released/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2010/09/08/olog-1-2-is-released/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 09:24:42 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Olog]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/?p=424</guid>
		<description><![CDATA[Since the last update, I&#8217;ve slowed down on the public updates and let each change sink in an mature a bit to make sure it works as expected. That explains the jump from version 1.1 to version 1.2. Download/checkout here.
New in version 1.2:
Features:



Added shorthand function otrace()
Added utility function breakPoint() for logging virtual break points
Added utility [...]]]></description>
			<content:encoded><![CDATA[<p>Since the last update, I&#8217;ve slowed down on the public updates and let each change sink in an mature a bit to make sure it works as expected. That explains the jump from version 1.1 to version 1.2. <a href="http://code.google.com/p/olog/" target="_blank">Download/checkout here.</a></p>
<h4>New in version 1.2:</h4>
<div id="_mcePaste"><strong>Features:</strong></div>
<div><strong></p>
<div>
<ul>
<li><span style="font-weight: normal;">Added shorthand function otrace()</span></li>
<li><span style="font-weight: normal;">Added utility function breakPoint() for logging virtual break points</span></li>
<li><span style="font-weight: normal;">Added utility function nullFunction for use in yet to be assigned callback situations</span></li>
<li><span style="font-weight: normal;">Added utility fucntion getCallee() for returning the string of a point in the call stack</span></li>
<li><span style="font-weight: normal;">Added utility function noMethodBodyWarning() for indicating an empty method and its position</span></li>
<li><span style="font-weight: normal;">Log messages from Olog itself now have a proper origin</span></li>
<li><span style="font-weight: normal;">More thorough introspection when using describe method. More properties found.</span></li>
<li><span style="font-weight: normal;">Added automatic regular trace output via property enableRegularTraceOutput</span></li>
<li><span style="font-weight: normal;">Added memory usage display in title bar</span></li>
<li><span style="font-weight: normal;">Update check is off by default</span></li>
<li><span style="font-weight: normal;">Describe robustness</span></li>
<li><span style="font-weight: normal;">More info when tracing runtime info</span></li>
<li><span style="font-weight: normal;">Added line wrapping preference</span></li>
</ul>
</div>
<div><span style="font-weight: normal;"><strong>Fixes:</strong></span></div>
<div>
<ul>
<li><span style="font-weight: normal;">Resolved issue where prefs pane would stay open after minimizing</span></li>
<li><span style="font-weight: normal;">Resolved issue with filtering on log level</span></li>
<li><span style="font-weight: normal;">General stability fixes</span></li>
<li><span style="font-weight: normal;">More compressed log statements with IOErrorEvents</span></li>
<li><span style="font-weight: normal;">Resolved text coloring and object name bug with describe</span></li>
</ul>
</div>
<p></strong></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2010/09/08/olog-1-2-is-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ditch Events!</title>
		<link>http://www.oyvindnordhagen.com/blog/2010/09/07/ditch-events/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2010/09/07/ditch-events/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 12:08:46 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/?p=413</guid>
		<description><![CDATA[How many objects have only one listener?
ActionScript has an amazingly functional event model. For many uses it is the most appropriate option. But at the same time it does have a performance overhead and can easily get the garbage collector out of shape if you&#8217;re not meticulous about cleaning up after yourself. But worst of [...]]]></description>
			<content:encoded><![CDATA[<h4><em>How many objects have only one listener?</em></h4>
<p>ActionScript has an amazingly functional event model. For many uses it is the most appropriate option. But at the same time it does have a performance overhead and can easily get the garbage collector out of shape if you&#8217;re not meticulous about cleaning up after yourself. But worst of all is having to read the execution order as it jumps up and down your class. There are alternatives out there that are getting positive feedback, like <a href="http://github.com/robertpenner/as3-signals" target="_blank">Robert Penner&#8217;s AS3 Signals</a> and several frameworks like <a href="http://puremvc.org/" target="_blank">PureMVC</a> and <a href="http://www.robotlegs.org/" target="_blank">Robotlegs</a> have their own internal notification models. But not all types of notification lend themselves to complex implementations like these. Sometimes a simple callback function is just the right thing. Code readability and Performance are two benefits you can reap. Strictness is another.</p>
<p>Here&#8217;s an example:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p413code3'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4133"><td class="code" id="p413code3"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> loadData <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">url</span>:<span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	_dataParser = <span style="color: #000000; font-weight: bold;">new</span> DataParser<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	_dataParser.<span style="color: #006600;">dataAvailableCallback</span> = _notifyDataLoaded;		
	_dataLoader = <span style="color: #000000; font-weight: bold;">new</span> DisposableXMLLoader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	_dataLoader.<span style="color: #006600;">successCallback</span> = _dataParser.<span style="color: #006600;">setData</span>;
	_dataLoader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">url</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>DisposableXMLLoader is a library class of mine that wraps the extra lines of code needed to use a URLLoader in Flash. Nothing fancy, just code I don&#8217;t need to see all the time. It also cleans up after itself after the load operation. Most of the time, only one object is interested in knowing when the load operation completes, so DisposableXMLLoader simply has public member variables named successCallback and errorCallback. The successCallback is called with the loaded XML document as it&#8217;s only argument, and errorCallback will receive whichever ErrorEvent occurred.</p>
<p>DataParser is a class most of my projects have in the model package. It&#8217;s sole purpose is to retrieve, cast and return data from XML in the form of primitive datatypes or value objects. It is the only class in my application that is allowed knowledge of the XML document&#8217;s structure. It also sports a public member variable to hold the callback function that is called when it is ready to start fetching data from the XML.</p>
<p>Using the traditional AS3 event model, the above example would be written something like this.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p413code4'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4134"><td class="code" id="p413code4"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> loadData <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">url</span>:<span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	_dataParser = <span style="color: #000000; font-weight: bold;">new</span> DataParser<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	_dataParser.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> DataParserEvent.<span style="color: #006600;">DATA_AVAILABLE</span> , _onDataAvailable <span style="color: #66cc66;">&#41;</span>;
	_dataLoader = <span style="color: #000000; font-weight: bold;">new</span> DisposableXMLLoader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	_dataLoader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span> XMLLoaderEvent.<span style="color: #006600;">DATA_LOADED</span> , _onDataLoaded <span style="color: #66cc66;">&#41;</span>;
	_dataLoader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">url</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> _onDataLoaded <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:XMLLoaderEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	_dataParser.<span style="color: #006600;">setData</span><span style="color: #66cc66;">&#40;</span> _dataLoader.<span style="color: #006600;">getData</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> _onDataAvailable <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">e</span>:DataParserEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	_notifyDataLoaded<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>In fact this would probably be even more complex because if I wasn&#8217;t using callbacks, I would probably have used a standard URLLoader instead. Wiring up one of those for both success and error handling would produce about twice as many lines of code.</p>
<p>To be honest, I usually don&#8217;t really care that much about performance. Most of what I do is not that intensive anyway. But I do care about clean code and what I love about the callback approach is how compact it all becomes and the fact that I can see the whole execution order in just 5 lines of code. If I wanted, I could compress the code even more by adding the callbacks as constructor arguments, but I prefer the explicitness of that extra line.</p>
<p>Just remember to null the reference to the callback after you call it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2010/09/07/ditch-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick AS3 tip: find out where a function was called from</title>
		<link>http://www.oyvindnordhagen.com/blog/2010/09/06/quick-as3-tip-find-out-where-a-function-was-called-from/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2010/09/06/quick-as3-tip-find-out-where-a-function-was-called-from/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 13:26:32 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/?p=406</guid>
		<description><![CDATA[If you&#8217;re relying on this with your regular production code, you&#8217;re probably going about your craft in a very, very backwards fashion. But sometimes when your are debugging or, like in my case, writing a logging application it is helpful to know where a method was called from.
In AS2 we had the implicit callee object [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re relying on this with your regular production code, you&#8217;re probably going about your craft in a very, very backwards fashion. But sometimes when your are debugging or, like in my case, writing a logging application it is helpful to know where a method was called from.</p>
<p>In AS2 we had the implicit callee object inside a function scope that would carry a reference to the currently executing function. In AS3 a bit more hacking is required. Whenever an error is thrown, you notice the stack trace below it. this contains all you need for debugging purposes and we can massage it a bit to present it in a more focused fashion.<br />
<a href="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2010/09/Skjermbilde-2010-09-06-kl.-15.04.26.png" rel="lightbox[406]"><img class="alignnone size-full wp-image-407" title="Darn" src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2010/09/Skjermbilde-2010-09-06-kl.-15.04.26.png" alt="" width="682" height="302" /></a></p>
<p>This stack trace is produced whenever a new Error object is instantiated and with the &#8220;throw&#8221; keyword in front of it, it&#8217;ll show up like above. No error dialog is spawned if you don&#8217;t throw the error instance, but the stack trace is still produced, and you can reference it with the getStackTrace method. After that, it&#8217;s all parsing to get to the bits you want.</p>
<p>For instance, I wanted to display just the class name and line number. This will do the trick:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p406code7'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4067"><td class="code" id="p406code7"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> location:<span style="color: #0066CC;">String</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">match</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>?<span style="color: #66cc66;">&amp;</span>lt;=\<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#41;</span>\w+?.<span style="color: #006600;">as</span>:\d+?<span style="color: #66cc66;">&#40;</span>?=<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span>g <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;:&quot;</span> , <span style="color: #ff0000;">&quot;, line &quot;</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> location <span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>This will output something similar to this (depending on the location it was called from):</p>
<pre>ComponentView.as, line 89</pre>
<p>I used this to create a nullFunction that can be inserted in place of undefined function references (see below for the class) <a href="http://oyvindnordhagen.com/blog/olog">Olog</a> displays it like this:</p>
<p><a href="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2010/09/Skjermbilde-2010-09-06-kl.-15.11.08.png" rel="lightbox[406]"><img class="alignnone size-full wp-image-408" title="Olog" src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2010/09/Skjermbilde-2010-09-06-kl.-15.11.08.png" alt="" width="545" height="221" /></a></p>
<p>Here&#8217;s the class:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p406code8'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4068"><td class="code" id="p406code8"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">oyvindnordhagen</span>.<span style="color: #006600;">framework</span>.<span style="color: #006600;">nullobj</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> no.<span style="color: #006600;">olog</span>.<span style="color: #006600;">Olog</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">/**
	 * @author Oyvind Nordhagen
	 * @date 3. sep. 2010
	 */</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> nullFunction <span style="color: #66cc66;">&#40;</span> ...<span style="color: #006600;">args</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">var</span> location:<span style="color: #0066CC;">String</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Error</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">match</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#40;</span>?<span style="color: #66cc66;">&lt;</span>=\<span style="color: #66cc66;">/</span><span style="color: #66cc66;">&#41;</span>\w+?.<span style="color: #006600;">as</span>:\d+?<span style="color: #66cc66;">&#40;</span>?=<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span>g <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;:&quot;</span> , <span style="color: #ff0000;">&quot;, line &quot;</span> <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> location <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">text</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">&quot;Null Function Reference&quot;</span>;
		<span style="color: #0066CC;">text</span> += <span style="color: #66cc66;">&#40;</span>args <span style="color: #66cc66;">&amp;&amp;</span> args.<span style="color: #0066CC;">length</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #ff0000;">&quot; with arguments &quot;</span> + args.<span style="color: #0066CC;">join</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;, &quot;</span> <span style="color: #66cc66;">&#41;</span> : <span style="color: #ff0000;">&quot;&quot;</span>;
		<span style="color: #0066CC;">text</span> += <span style="color: #ff0000;">&quot; at &quot;</span> + location;
		Olog.<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">text</span> , <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2010/09/06/quick-as3-tip-find-out-where-a-function-was-called-from/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing a decent API</title>
		<link>http://www.oyvindnordhagen.com/blog/2010/06/08/writing-a-decent-api/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2010/06/08/writing-a-decent-api/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 23:12:41 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Problems & Solutions]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/?p=385</guid>
		<description><![CDATA[Over the last 6 months I&#8217;ve had to employ many Flash libraries that I have not worked with before. What strikes me is how poorly documented they are and how badly written some of them are. I won&#8217;t mention names, but I suspect some of you have an idea of where to find code like [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last 6 months I&#8217;ve had to employ many Flash libraries that I have not worked with before. What strikes me is how poorly documented they are and how badly written some of them are. I won&#8217;t mention names, but I suspect some of you have an idea of where to find code like this. In order to make the world a better place — as always — here are two reminders that would help.</p>
<h3>Use coding standards and best practices</h3>
<p>Proper method names, argument names, argument types and return values are crucial to the mere mortals trying to use your API. Keep an eye on your naming schemes! Use the common denominator of data types when you can and create specialized value objects when necessary. This method signature might make perfect sense to you at a time of writing:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p385code13'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38513"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p385code13"><pre class="actionscript" style="font-family:monospace;">getCoords<span style="color: #66cc66;">&#40;</span> arg1:<span style="color: #66cc66;">*</span>, arg2:<span style="color: #66cc66;">*</span>, ar3:<span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Object</span></pre></td></tr></table></div>

<p>&#8230;but please clean that up when you release it to the general public! Answer me this: What kind of coordinates are we requesting? What kind of input is expected and what are their types? And what the hell does that generic return type contain exactly?? Might I suggest something like:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p385code14'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38514"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p385code14"><pre class="actionscript" style="font-family:monospace;">getCityCoordinates<span style="color: #66cc66;">&#40;</span> region:<span style="color: #0066CC;">String</span>, country:<span style="color: #0066CC;">String</span>, city:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:Coordinates</pre></td></tr></table></div>

<p>You might think this kind of thing is trivial and basic. And it is, hence my bafflement when I read stuff like the first example in library released as the official API for one of the more common social media RIAs. You couldn&#8217;t imagine how many APIs out there break away from such common sense.</p>
<h3>Clean up after yourself!</h3>
<p>There are libraries out there without a single line terminated by a semi colon. As we know, the semis are optional, but they can cause the dreaded &#8220;internal build error/classes may not be nested&#8221; situation in Eclipse-based IDEs which usually eats up at least half a day of valuable time. I&#8217;ve had it happen to me, and needless to say I don&#8217;t consider semi colons to be optional. I use FDT to write my code and I have it set up to present me with an error whenever it comes across an unterminated line.</p>
<p>Other known culprits of internal build error are empty constructs like if-, for-, while and switch statements in addition to empty classes and interfaces. If there are incomplete sections in the API, pull them out and make sure the rest of the code doesn&#8217;t reference them.</p>
<h3>Write proper ASDocs</h3>
<p>How many libraries out there merely repeat the method signatures in the ASDocs? Then what&#8217;s the point? Most sane people use advances IDEs that will present ASDocs even inline with the code hinting, so make the most of it when the function and argument names cannot convey the full purpose of a property, event or method. To demonstrate, I will give an example from the ASDocs of <a href="http://www.oyvindnordhagen.com/blog/olog">my own logger utility, the Olog</a>. I will not be humble in this case, because Olog&#8217;s ASDocs are in fact immaculate.</p>
<p>The main logic is spread across 10 classes, but there&#8217;s only two access points to the log console; the specialized event type and the Olog class itself. The Olog class serves a single purpose: It is the <em>interface</em>, the <em>Application Programming <strong>Interface</strong></em>. It serves as the entry and exit point and the position of all the documentation. The core of the module is not as pretty, but that&#8217;s my problem. The Olog class consists of well named functions and getters and setters, all with comprehensive and highly cohesive ASDocs. In a sense you could say that this class&#8217; primary purpose is to act as the black surface coating in the black box principle; it&#8217;s there to stop the reader from digging deeper, or should I say to make it totally unnecessary to dig deeper. Most of the methods have a single line in them, a call to another core method. This allows this class to focus on the task of providing decent documentation. The ASDocs are generated from this file.</p>
<p>This is a method from within the core of Olog:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p385code15'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38515"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p385code15"><pre class="actionscript" style="font-family:monospace;">internal <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> newTimeMarker<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>:<span style="color: #0066CC;">String</span> = <span style="color: #000000; font-weight: bold;">null</span>, origin:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">int</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">String</span> = <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #0066CC;">name</span> : <span style="color: #ff0000;">&quot;Operation&quot;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> o:<span style="color: #0066CC;">String</span> = Otils.<span style="color: #006600;">parseOrigin</span><span style="color: #66cc66;">&#40;</span> origin <span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> t:<span style="color: #0066CC;">int</span> = <span style="color: #0066CC;">getTimer</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">return</span> _runTimeMarkers.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#91;</span>n, t, o<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span> - <span style="color: #cc66cc;">1</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>But from the outside of the box it appears like this:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p385code16'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38516"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p385code16"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
* Creates a timing marker that you can later complete by calling completeTimeMarker() to
* output the time in between.
* @param name String reference to use when the marker completes an results are displayed.
* @return An integer ID to use as argument when calling completeTimeMarker().
* @see completeTimeMarker()
*/</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> newTimeMarker<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span>:<span style="color: #0066CC;">String</span> = <span style="color: #000000; font-weight: bold;">null</span>, origin:<span style="color: #0066CC;">Object</span> = <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">int</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">return</span> Ocore.<span style="color: #006600;">newTimeMarker</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">name</span> , origin <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>Thats a ratio of 5:2 of respectively documentation and actual code! By using the Olog class as a dedicated API layer, I&#8217;m able to use that class as both a source of proper ASDocs and a structural reference for myself.</p>
<p>Now, pretty please&#8230;?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2010/06/08/writing-a-decent-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Microphone confirmation dialog not showing in Firefox</title>
		<link>http://www.oyvindnordhagen.com/blog/2010/05/11/microphone-confirmation-dialog-not-showing-in-firefox/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2010/05/11/microphone-confirmation-dialog-not-showing-in-firefox/#comments</comments>
		<pubDate>Tue, 11 May 2010 07:58:59 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Problems & Solutions]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[confirmation]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[microphone]]></category>
		<category><![CDATA[swfobject]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/?p=377</guid>
		<description><![CDATA[A few days ago I was struggling with an application that made use of the client computer&#8217;s microphone for crucial functions. The problem was that the built-in security settings panel for granting access to the microphone did not open in Firefox on the Mac.
Normally, whenever you do this:
var mic:Microphone = Microphone.getMicrophone();
The Flash Player automatically opens [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I was struggling with an application that made use of the client computer&#8217;s microphone for crucial functions. The problem was that the built-in security settings panel for granting access to the microphone did not open in Firefox on the Mac.</p>
<p>Normally, whenever you do this:</p>
<pre class="actionscript3" line="1">var mic:Microphone = Microphone.getMicrophone();</pre>
<p>The Flash Player automatically opens this panel to ask the user to allow the microphone to be connected:<br />
<a href="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2010/05/Skjermbilde-2010-05-11-kl.-09.39.27.png" rel="lightbox[377]"><img class="alignnone size-full wp-image-378" title="Flash Player Microphone confirmation dialog box" src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2010/05/Skjermbilde-2010-05-11-kl.-09.39.27.png" alt="Flash Player Microphone confirmation dialog box" width="534" height="212" /></a></p>
<p>Of course this panel is never invoked if the user has the settings set to always allow or always deny, but very few do.</p>
<p>When this sucker never presented itself, I naturally thought that I was doing something wrong. Let&#8217;s face it, that&#8217;s the most probable cause. But after a while I noticed that the problem was specific to Firefox on the Mac. Knowing that SWFObject has had it&#8217;s issues with FIrefox in the past, I tried swapping it out for the jQueryFlash plugin, and voilà! How the JavaScript insertion method of the flash content could possibly cause it is beyond me. Honestly I don&#8217;t have the JS knowledge or interest to investigate either, seeing as I had a solution.</p>
<p>With SWFObject 1.5 there was a problem causing the stageWidth and stageHeight to be 0 for a certain time after the movie was loaded. That might be relevant in this case as well, but the microphone dialog was supposed to open long after the movie was fully loaded. That kinda rules it out.</p>
<p>So now you know. Don&#8217;t spend an entire night on this, like I did.</p>
<p>Get the Flash plugin for jQuery here:<br />
<a href="http://jquery.lukelutman.com/plugins/flash/">http://jquery.lukelutman.com/plugins/flash/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2010/05/11/microphone-confirmation-dialog-not-showing-in-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Olog &#8211; finally.</title>
		<link>http://www.oyvindnordhagen.com/blog/2010/03/08/olog-finally/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2010/03/08/olog-finally/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 05:20:47 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[AILogger]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Olog]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/?p=324</guid>
		<description><![CDATA[
Olog (formerly, AILogger formerly OKtrace, formerly text field on stage..) is a logging utility I have been using since the early days. The previous version, AILogger has been the most feature rich to date. But over the years a need to rewrite the whole thing has been growing more and more urgent. It actually started [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-293" title="OlogWindow" src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2010/03/OlogWindow.png" alt="" width="570" height="319" /></p>
<p>Olog (formerly, AILogger formerly OKtrace, formerly text field on stage..) is a logging utility I have been using since the early days. The previous version, AILogger has been the most feature rich to date. But over the years a need to rewrite the whole thing has been growing more and more urgent. It actually started life as an AS1 text field on stage, and was then made into an AS2 class which was then refactored for AS3. But after a while it became evident that it had been patched up too many times to do new things and was in desperate need of some overhaulin&#8217;.</p>
<p>It&#8217;s about time it took its name from its father as well, so I&#8217;m abandoning the scheme of naming it after my employer. (OKTrace = Okular, AILogger = Allegro Interaktiv). It has always been my pet project, so I&#8217;m taking it with me everywhere I go from now on. I also wanted a short name, seeing as I&#8217;ll be typing it a lot, so Olog it is (the &#8220;O&#8221; from Oyvind).</p>
<p>So this time it&#8217;ll be different, I promise! Olog 0.9 is actually AILogger 1.2 and then some in terms of features, but the first step in making it was &#8220;File &gt; New&#8221;. It&#8217;s completely rewritten, and no copy-paste this time. It has been tagging along during my latest project and so it has seen plenty of action already. I&#8217;ve tested it quite thoroughly, but it&#8217;s hard to say what happens when you try to live on your own for the first time. That&#8217;s why I have humbly versioned it 0.9b for now.</p>
<h2>New features</h2>
<p>Here are some new things you might like:</p>
<ul>
<li>Full featured window interface. Minimize/maximize/close buttons, double click on title bar to minimize. Moveable and resizable.</li>
<li>Selective line numbers, time-since-movie start and clock time for each line. These can all be turned of or off during run time.</li>
<li>Filtering of log levels. Pressing number keys 0-5 filters the log to show only those severity levels (color). Esc to escape.</li>
<li>Automatic update check. Olog will check for a new version once a week if you let it and notify you if there&#8217;s a newer version.</li>
<li>Save log to text/XML.</li>
<li>Persistent window state. Position, size, minimized/maximized state is remembered so you don&#8217;t have to keep moving it out of the way each time you compile.</li>
<li>Run time markers. Set a new named point-in-time marker, which you can later complete to display load/execution times.</li>
<li>Support for AILoggerEvents, but Olog has it&#8217;s own OlogEvent as well for loosely coupled logging.</li>
<li>Stacking of repeated messages.</li>
<li>Full ASDoc documentation.</li>
</ul>
<p><a href="http://www.oyvindnordhagen.com/blog/olog/">The olog page on my blog</a> has all the links you need, <a href="http://olog.googlecode.com/files/Olog0.9b.zip">direct ZIP download</a>, <a href="http://olog.googlecode.com/svn/trunk/">SVN repo access</a>, <a href="http://www.oyvindnordhagen.com/olog/docs/">asdoc documentation</a>, <a href="http://code.google.com/p/olog/">Google Code homepage</a> and even a <a href="http://www.oyvindnordhagen.com/blog/olog/">simple demo</a>. I&#8217;ll love to hear it if you have feedback!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2010/03/08/olog-finally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RegExp matching unterminated ActionScript lines (semicolon)</title>
		<link>http://www.oyvindnordhagen.com/blog/2010/02/04/regexp-matching-unterminated-actionscript-lines-semicolon/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2010/02/04/regexp-matching-unterminated-actionscript-lines-semicolon/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 10:42:11 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[Problems & Solutions]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/?p=251</guid>
		<description><![CDATA[
Today I had the dreaded &#8220;1131: Internal build error&#8221; in Flash Builder coupled with the &#8220;Classes must not be nested error&#8221; despite no classes actually being nested. Googling around, I found a few posts that provide some tips towards a solution. The most frequent two of which are empty switch statements and ActionScript lines that [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-254" title="Skjermbilde 2010-02-04 kl. 11.40.44" src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2010/02/Skjermbilde-2010-02-04-kl.-11.40.44.png" alt="Skjermbilde 2010-02-04 kl. 11.40.44" width="570" height="91" /></p>
<p>Today I had the dreaded &#8220;1131: Internal build error&#8221; in Flash Builder coupled with the &#8220;Classes must not be nested error&#8221; despite no classes actually being nested. Googling around, I found a few posts that provide some tips towards a solution. The most frequent two of which are empty switch statements and ActionScript lines that are not properly terminated with a semicolon. The project in questing uses over 100 classes, so I decided to create a RegExp for use in &#8220;Find In Files&#8221; to search for lines that were not properly terminated.</p>
<p>As an extra caveat, many types of lines in programming are not supposed to be terminated, so the RegExp is quite long and I have not been able to test it any more than the said 100-class project I&#8217;m working on.</p>
<p><strong>NOTE: This might macth some multiline ASDoc comments, empty lines and method argument lists spanning multiple lines as well.</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p251code18'); return false;">View Code</a> REGEXP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p25118"><td class="code" id="p251code18"><pre class="regexp" style="font-family:monospace;">(?sim)(?&lt;!/\*)^\t*((?!\{|\}|@)(?!function|import|class|embed|SWF|if|else|switch|case|while|for|event|try|catch|finally|package|default|//|/\*|\*/)[^;])+$(?!.*\*/)</pre></td></tr></table></div>

<p>Here are the posts I found:</p>
<ul>
<li><a href="http://rjowen.wordpress.com/2007/06/21/internal-build-error-or-classes-must-not-be-nested-error/" target="_blank">flex&#8217;d: “Internal Build Error” or “Classes Must Not Be Nested” error</a></li>
<li><a href="http://www.insideria.com/2009/09/fixed-an-internal-build-error.html">Inside RIA: Fixed: &#8220;An internal build error has occurred&#8221; with FB3 &amp; Galileo</a></li>
<li><a href="http://www.tink.ws/blog/an-internal-build-error-has-occurred-switch-statement/" target="_blank">Tink: An internal build error has occurred (switch statement)</a></li>
<li><a href="http://michael.omnicypher.com/2007/02/internal-build-error.html" target="_blank">Michael Imhoff: Internal Build Error</a></li>
<li><a href="http://www.judahfrangipane.com/blog/?p=212" target="_blank">judah’s blog: Internal Build Error</a></li>
</ul>
<p>EDIT: Added &#8220;default&#8221; to the RegExp. If anyone has any improvements to this, please let me know. Especially on how to make it not match so many empty lines.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2010/02/04/regexp-matching-unterminated-actionscript-lines-semicolon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SlowLoader &#8211; Easy bandwidth simulation util for Flash</title>
		<link>http://www.oyvindnordhagen.com/blog/2010/01/06/slowloader-easy-bandwidth-simulation-util-for-flash/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2010/01/06/slowloader-easy-bandwidth-simulation-util-for-flash/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 20:58:32 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Freebies]]></category>
		<category><![CDATA[General thoughts]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[bandwidth]]></category>
		<category><![CDATA[connection speed]]></category>
		<category><![CDATA[simulation]]></category>
		<category><![CDATA[SlowLoader]]></category>
		<category><![CDATA[throttle]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/?p=234</guid>
		<description><![CDATA[Today I was working on a project with real strange issues related to the duration of load operations. I decided to throw together a class that would enable me to throttle the download speed of the Loader class when used locally. Simply strangle the bandwidth by entering the desired speed in the load method and [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was working on a project with real strange issues related to the duration of load operations. I decided to throw together a class that would enable me to throttle the download speed of the Loader class when used locally. Simply strangle the bandwidth by entering the desired speed in the load method and you&#8217;re good to go.</p>
<p><a href="/public/SlowLoader.zip"><img class="alignleft size-full wp-image-54" src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/01/zip.gif" alt="" width="32" height="32" /></a><a href="/public/SlowLoader.zip"><br />
Download SlowLoader.as</a></p>
<p>It works very much the same way as the Loader class with the only difference being that you add your event listeners directly to the SlowLoader instance instead of the contentLoaderInfo instance of the Loader instance. Other than that it dispatches the same events as the Loader class does so it should be fairly simple to swap it for a regular Loader when you&#8217;re done. I&#8217;ve also included and example class. Here&#8217;s an excerpt of it:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p234code20'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23420"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p234code20"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> l<span style="color: #000066; font-weight: bold;">:</span>SlowLoader = <span style="color: #0033ff; font-weight: bold;">new</span> SlowLoader<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
l<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">ProgressEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">PROGRESS</span><span style="color: #000066; font-weight: bold;">,</span> _updateProgress<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
l<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">INIT</span><span style="color: #000066; font-weight: bold;">,</span> _showImage<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
l<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;file.jpg&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">512</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0.9</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div>

<p>NOTE: SlowLoader was developed for my own use, which means that it dispatches AILoggerEvents for printing log messages from it. AILogger is also included in the ZIP file and <a href="http://ailogger.googlecode.com">you can read more about it here</a>. If you do not wish to use it, feel free to strip these lines out of the class.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2010/01/06/slowloader-easy-bandwidth-simulation-util-for-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 dictionary back to back in 4 months</title>
		<link>http://www.oyvindnordhagen.com/blog/2009/11/09/as3-dictionary-back-to-back-in-4-months/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2009/11/09/as3-dictionary-back-to-back-in-4-months/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 03:03:48 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[General thoughts]]></category>
		<category><![CDATA[ActionScript]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/2009/11/09/as3-dictionary-back-to-back-in-4-months/</guid>
		<description><![CDATA[
As some of you might know, I&#8217;m in layoff from my job as a flash developer at Allegro Interaktiv. I&#8217;ve been thinking hard and well about what I want to spend this period of four months doing. I will be freelancing a little if I can (in agreement with my employer of course), spend time [...]]]></description>
			<content:encoded><![CDATA[<p style="clear: both"><img class="alignnone size-full wp-image-223" title="AS3 Language Reference and Dictionary" src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2009/11/asref.jpg" alt="AS3 Language Reference and Dictionary" width="570" height="300" /></p>
<p style="clear: both">As some of you might know, I&#8217;m in layoff from my job as a flash developer at <a href="http://www.allegro.no" target="_blank">Allegro Interaktiv</a>. I&#8217;ve been thinking hard and well about what I want to spend this period of four months doing. I will be freelancing a little if I can (in agreement with my employer of course), spend time with my family, and also catch up on a few forsaken hobbies.</p>
<p style="clear: both">But this sudden abundance of free time obviously creates a pefect climate for getting up to speed on new Flash libraries and dig deeper into the ones I already know. Like the AS3 core classes. That&#8217;s why I&#8217;ve given my self a perhaps rediculous challenge; to read the complete ActionScript Language Reference back to back over the next four months. This is clearly perversely nerd-like and all that, but here&#8217;s why.</p>
<p style="clear: both">
<h2>The case for reading it all</h2>
<p style="clear: both">Actually I&#8217;ve been thinking about it for a few years. You see every time I look up a class or a method in the dictionary, I usually read one or two paragraphs more than I need. Often I learn something new that&#8217;s been sitting just below the surface of what I already know. At times the AS3 language reference is not even that badly written and the examples are usually useful. So instead of googling for tutorials about particle engines, Papervision and what not, I decided that before trying to gain something completely new I&#8217;d be better off getting to know the old annoying aunt intimately. Well not in that sense&#8230; sorry, you know what I mean.</p>
<p style="clear: both">
<h2>You should too!</h2>
<p style="clear: both">I&#8217;m not saying you really should join me in this preposterous endeavour, but I am serious in that many tend to overlook what a great resource the AS3 Language Reference really is. So the essence is really that you can learn a lot from what you already have at a single keyboard command (shift-F1 in Flash that is). Look up some random class name that you&#8217;ve never used an find out what it&#8217;s for. You might be glad you did.</p>
<p style="clear: both">In the mean time, you can follow my progress here at the blog, and if you <a href="http://www.twitter.com/nordhagen" target="_blank">follow me on Twitter</a>.</p>
<p><br class="final-break" style="clear: both" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2009/11/09/as3-dictionary-back-to-back-in-4-months/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AILogger 1.2 is out!</title>
		<link>http://www.oyvindnordhagen.com/blog/2009/09/15/ailogger-1-2-is-out/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2009/09/15/ailogger-1-2-is-out/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 08:40:16 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[AILogger]]></category>
		<category><![CDATA[Adobe Flash]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/2009/09/15/ailogger-1-2-is-out/</guid>
		<description><![CDATA[After a few months of refinement It&#8217;s time to bring out a new version of AILogger. This time these are the improvements:


Added public describe method to log all properties of an object
Added support for CODE_TRACE, these lines are color coded gray.
passwordDisabled property renamed to disablePassword
stampLinesWithSender property renamed to disableSenderLabel
Fixed support for CODE_EVENT log coloring
Supports new [...]]]></description>
			<content:encoded><![CDATA[<p style="clear: both"><img style=" display: inline; float: left; margin: 0 10px 10px 0;" src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2009/09/ailogger_slanted3-thumb.jpg" alt="" width="379" height="251" align="left" /><br style="clear: both" />After a few months of refinement It&#8217;s time to bring out a new version of AILogger. This time these are the improvements:</p>
<p style="clear: both">
<ul style="clear: both">
<li>Added public describe method to log all properties of an object</li>
<li>Added support for CODE_TRACE, these lines are color coded gray.</li>
<li>passwordDisabled property renamed to disablePassword</li>
<li>stampLinesWithSender property renamed to disableSenderLabel</li>
<li>Fixed support for CODE_EVENT log coloring</li>
<li>Supports new paramteter origin in AILoggerEvent to specify the sender of a log message</li>
<li>Better handling of logged ErrorEvents</li>
<li>Now recognizes logged color numbers and displays it&#8217;s HEX code and colors the line with that color</li>
</ul>
<p style="clear: both">Get it <a href="http://www.oyvindnordhagen.com/blog/ailogger/">here</a></p>
<p><br class="final-break" style="clear: both" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2009/09/15/ailogger-1-2-is-out/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
