<?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; Problems &amp; Solutions</title>
	<atom:link href="http://www.oyvindnordhagen.com/blog/category/flash/problems-solutions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.oyvindnordhagen.com/blog</link>
	<description>Øyvind Nordhagen on ActionScript and other things</description>
	<lastBuildDate>Mon, 06 Sep 2010 13:26:32 +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>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('p385code5'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3855"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p385code5"><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('p385code6'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3856"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p385code6"><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('p385code7'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3857"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p385code7"><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('p385code8'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3858"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p385code8"><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>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('p251code10'); return false;">View Code</a> REGEXP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p25110"><td class="code" id="p251code10"><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>Stangle your bandwidth with Entonnoir (free)</title>
		<link>http://www.oyvindnordhagen.com/blog/2009/03/03/stangle-your-bandwidth-with-entonnoir-free/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2009/03/03/stangle-your-bandwidth-with-entonnoir-free/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 22:46:36 +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=134</guid>
		<description><![CDATA[Just found this surrealistically fantastic app that&#8217;s really useful for web developers. Entonnoir let&#8217;s you select how fast you want your mac&#8217;c internet connection to be. And when you&#8217;re on 100 Mbit at the office trying to test a preloader, it really comes in handy. It&#8217;s free too, so what are you waiting for?
Download Entonnoir
]]></description>
			<content:encoded><![CDATA[<p><a title="Entonnoir" href="http://tools.chocoflop.com/entonnoir_en.html"><img class="attachment wp-att-136 alignright" src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2009/03/enton80.png" alt="Entonnoir" width="80" height="80" /></a>Just found this surrealistically fantastic app that&#8217;s really useful for web developers. Entonnoir let&#8217;s you select how fast you want your mac&#8217;c internet connection to be. And when you&#8217;re on 100 Mbit at the office trying to test a preloader, it really comes in handy. It&#8217;s free too, so what are you waiting for?</p>
<p><a href="http://tools.chocoflop.com/entonnoir_en.html">Download Entonnoir</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2009/03/03/stangle-your-bandwidth-with-entonnoir-free/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Asset SWF, loading/embedding has fundamental differences</title>
		<link>http://www.oyvindnordhagen.com/blog/2008/12/04/asset-swf-loadingembedding-has-fundamental-differences/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2008/12/04/asset-swf-loadingembedding-has-fundamental-differences/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 11:45:15 +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=131</guid>
		<description><![CDATA[
So after a few headaches I arrived at a thesis (at best):  If developing and compiling in Flex Builder, but using a library of assets (in the form of a SWF-file) compiled by the Flash IDE, loading the assets.swf at runtime and embedding are not going to give you equal access the assets and [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Embed or getDefinition" href="http://www.oyvindnordhagen.com/blog/?attachment_id=132"><img class="attachment wp-att-132 " src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/12/embed_getdefinition.jpg" alt="Embed or getDefinition" width="489" height="300" /></a></p>
<p>So after a few headaches I arrived at a thesis (at best):  If developing and compiling in Flex Builder, but using a library of assets (in the form of a SWF-file) compiled by the Flash IDE, loading the assets.swf at runtime and embedding are not going to give you equal access the assets and their associated classes.  Loading the asset SWF will enable you to use:</p>
<pre style="padding-left: 30px;">loader.contentLoaderInfo.applicationDomain.getDefinition("MySymbolClass")</pre>
<p>That will return a class definition of the library symbol <strong><em>and it&#8217;s associated custom class and base class.</em></strong></p>
<p><strong><em></em></strong>However:</p>
<pre style="padding-left: 30px;">[Embed(source="assets.swf", symbol="MySymbol")]
var MySymbolClass:Class;</pre>
<p>will yield, put simply, the most descriptive, built-in class able to describe the symbol. But that&#8217;s at the discretion of the compiler.  So if I have a button with an associated custom class, let&#8217;s say FancyButton, in assets.swf, that code will be elegantly ingnored by the Flex compiler and I&#8217;m only able to datatype the button as Sprite or MovieClip (if it has more than one frame).  So I&#8217;m guessing the philosophy behind the embed compiler directive is that it is meant for embedding primitive assets, like bitmaps, sprites, fonts and so on <strong><em>into the class that adds the fancy, custom code,</em></strong> while loading and using getDefinition is the only way that will allow the assets to have custom code associated with them.</p>
<p>As seen in the photo comic above from the 70&#8242;, this discussion might have been going on for a while without me knowing it. I think I will be loading my asset SWF at runtime from now on unless someone has a good reason for me not to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2008/12/04/asset-swf-loadingembedding-has-fundamental-differences/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash On The Beach &#8211; Thank You!</title>
		<link>http://www.oyvindnordhagen.com/blog/2008/10/20/flash-on-the-beach-thank-you/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2008/10/20/flash-on-the-beach-thank-you/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 21:00:56 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Problems & Solutions]]></category>
		<category><![CDATA[08]]></category>
		<category><![CDATA[Bar]]></category>
		<category><![CDATA[FOTB]]></category>
		<category><![CDATA[Hotel]]></category>
		<category><![CDATA[Old]]></category>
		<category><![CDATA[Ship]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/?p=97</guid>
		<description><![CDATA[
Just wanted to say thank you to everyone who ran and attended Flash On The Beach &#8216;08 in Brighton. I had a great time! Here&#8217;s a photo I wanted to share. It&#8217;s from the Old Ship Hotel bar tuesday night after The Honey Club ran out of beer in just one hour. It was taken [...]]]></description>
			<content:encoded><![CDATA[<p><!--gallery--></p>
<div id="attachment_98" class="wp-caption alignnone" style="width: 310px"><a href="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/10/oldship.jpg" rel="lightbox[97]"><img class="size-medium wp-image-98" title="The Old Ship Hotel bar" src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/10/oldship-300x75.jpg" alt="The Old Ship Hotel bar filled to the limit with beer-loving flash developers" width="300" height="75" /></a><p class="wp-caption-text">The Old Ship Hotel bar filled to the limit with beer-loving flash developers</p></div>
<p>Just wanted to say thank you to everyone who ran and attended Flash On The Beach &#8216;08 in Brighton. I had a great time! Here&#8217;s a photo I wanted to share. It&#8217;s from the Old Ship Hotel bar tuesday night after The Honey Club ran out of beer in just one hour. It was taken with my camera phone, so please excuse the quality.</p>
<p>After the conference I got to kill a few hours in London, so I went to Hamleys to buy the mandatory travel gift for my son. And man do they have some fascinating stuff there. This is a 23 carat gold plated model of a Mercedes SLK which was explicitly stated &#8220;Not for sale&#8221;. Check it out:</p>
<p><img class="alignnone size-full wp-image-99" title="mercedes" src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/10/mercedes.jpg" alt="" width="489" height="322" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2008/10/20/flash-on-the-beach-thank-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SWFHeader &#8211; an alternative to sIFR custom font flash header</title>
		<link>http://www.oyvindnordhagen.com/blog/2008/08/09/swfheader-an-alternative-to-sifr-custom-font-flash-header/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2008/08/09/swfheader-an-alternative-to-sifr-custom-font-flash-header/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 23:05:16 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Problems & Solutions]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[sIFR]]></category>
		<category><![CDATA[SWFHeader]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/2008/08/09/swfheader-an-alternative-to-sifr-custom-font-flash-header/</guid>
		<description><![CDATA[
I while ago I worked on a HTML site that would implement sIFR for a custom header font. This was my first attempt at using it and I decided I didn&#8217;t really like it that much. Mostly because of the large JavaScript files needed.
I thought to myself that making my own solution needn&#8217;t bee so [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/08/swfheader.jpg" alt="SWFHeader" /></p>
<p>I while ago I worked on a HTML site that would implement <a href="http://novemberborn.net/">sIFR</a> for a custom header font. This was my first attempt at using it and I decided I didn&#8217;t really like it that much. Mostly because of the large JavaScript files needed.</p>
<p>I thought to myself that making my own solution needn&#8217;t bee so hard so I did. Here it is; introducing SWFHeader!</p>
<p>It works roughly the same way as sIFR does, but it&#8217;s a whole lot more stripped down. Like sIFR you edit a FLA-file to embed the font you want to use and export it. Then you insert a few lines into your HTML page and include the JavaScript file required. Now I recognize the fact that sIFR&#8217;s code probably is as vast as it is for a reason. Maybe it has better legacy browser support, I don&#8217;t really know. What I do know is SWFHeader has worked fine for me and behaves well in IE6+7, Safari and Firefox, and that&#8217;s enough for me.</p>
<p>If you&#8217;re interested then take it for a spin. There are no fascinating terms of usage to tick off a check box for, nor are there any guarantees. Merely my own experience. Therefore I recommend you test it properly. If you like it (or not) please let me know!</p>
<p><strong>Here are the files:</strong></p>
<p><a href="http://www.oyvindnordhagen.com/flashdev/SWFHeader.zip"><img src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/01/zip.gif" alt="zip.gif" /> SWFHeader.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2008/08/09/swfheader-an-alternative-to-sifr-custom-font-flash-header/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loaded SWF doesn&#8217;t run its code &#8211; no errors? WFT??</title>
		<link>http://www.oyvindnordhagen.com/blog/2008/04/30/loaded-swf-doesnt-run-its-code-no-errors-wft/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2008/04/30/loaded-swf-doesnt-run-its-code-no-errors-wft/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 11:25:09 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Problems & Solutions]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[ApplicationDomain]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[code not running]]></category>
		<category><![CDATA[document class]]></category>
		<category><![CDATA[host]]></category>
		<category><![CDATA[loaded swf]]></category>
		<category><![CDATA[no errors]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/2008/04/30/loaded-swf-doesnt-run-its-code-no-errors-wft/</guid>
		<description><![CDATA[
The other day I was writing the code for a simple animated movie. I decided to use a host flash to get the user started quickly and then create a separate SWF file for each scene in the movie. The host flash would then preload the next scene while the current one was playing. MovieHost.as [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/04/wtf.jpg" alt="WTF" /></p>
<p>The other day I was writing the code for a simple animated movie. I decided to use a host flash to get the user started quickly and then create a separate SWF file for each scene in the movie. The host flash would then preload the next scene while the current one was playing. MovieHost.as would be the document class for the host movie and Scene.as document class for all the scenes. Simple right? Budget: 6-7 hours including the stop frame animations&#8230;</p>
<p>Well, not quite so. I created all the animations in all the swiffs, set up the hos flash to load them in, pressed command+enter to verify my effectiveness. The host flash fires up and loads the first scene but the scene&#8217;s code does not seem to run at all. And no error messages? After all this is AS3 &#8211; WTF??</p>
<p>I won&#8217;t bore you with the details of all my testing, but it went to the point where I started to research the use of explicit application domains and such. After some hours I found the reason, and here it it:</p>
<p>From the Flash documentation on the ApplicationDomain class:</p>
<blockquote><p><em>&#8220;You cannot override a loaded class definition with a newer definition.&#8221;</em></p></blockquote>
<p>This says it all really. Close to the top of my HostMovie.as class (where I hadn&#8217;t been for a while) I found this line:</p>
<blockquote><p><font color="#ff0000">private</font> <font color="#339966">var</font> _currentScene:<font color="#ff0000">Scene</font>;</p></blockquote>
<p>Even though this variable was not being used in any way, the host flash still had a compiled version of the class Scene.as when the scene swiffs were being loaded. I f you look at the comment from the documentation again you realize that of course no code from the loaded swf could run, it&#8217;s document class had been discarded in favor of the one allready existing in the host flash.</p>
<p>I removed the unused property definition from HostMovie.as and everything from there on went as planned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2008/04/30/loaded-swf-doesnt-run-its-code-no-errors-wft/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash On The Beach wasn&#8217;t sold out after all</title>
		<link>http://www.oyvindnordhagen.com/blog/2008/04/24/flash-on-the-beach-wasnt-sold-out-after-all/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2008/04/24/flash-on-the-beach-wasnt-sold-out-after-all/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 06:49:26 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Problems & Solutions]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/2008/04/24/flash-on-the-beach-wasnt-sold-out-after-all/</guid>
		<description><![CDATA[Paulo and Tink were right after all; FOTB wasn&#8217;t sold out. The tickets page was just not updated from last year and I&#8217;ve got me a ticket. Yeah!
]]></description>
			<content:encoded><![CDATA[<p>Paulo and Tink were right after all; FOTB wasn&#8217;t sold out. The tickets page was just not updated from last year and I&#8217;ve got me a ticket. Yeah!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2008/04/24/flash-on-the-beach-wasnt-sold-out-after-all/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MasterPhoto.no launched!</title>
		<link>http://www.oyvindnordhagen.com/blog/2008/02/06/masterphotono-launched/</link>
		<comments>http://www.oyvindnordhagen.com/blog/2008/02/06/masterphotono-launched/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 23:42:35 +0000</pubDate>
		<dc:creator>Øyvind</dc:creator>
				<category><![CDATA[Problems & Solutions]]></category>
		<category><![CDATA[Adobe Flash]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[Masterphoto]]></category>
		<category><![CDATA[web site]]></category>

		<guid isPermaLink="false">http://www.oyvindnordhagen.com/blog/2008/02/06/masterphotono-launched/</guid>
		<description><![CDATA[
A really interesting project I&#8217;ve been doing at work is finally live after a little over a month in design and development. I am quite pleased with the result as it is a fully dynamic (with content management system on the way) all Flash, language extendable solution.
The language menu has had to be hidden from [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/02/masterphoto1.jpg" title="masterphoto1.jpg" rel="lightbox[63]"><img src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/02/masterphoto1.thumbnail.jpg" alt="masterphoto1.jpg" /></a><a href="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/02/masterphoto3.jpg" title="masterphoto3.jpg" rel="lightbox[63]"><img src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/02/masterphoto3.thumbnail.jpg" alt="masterphoto3.jpg" /></a><a href="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/02/masterphoto4.jpg" title="masterphoto4.jpg" rel="lightbox[63]"><img src="http://www.oyvindnordhagen.com/blog/wp-content/uploads/2008/02/masterphoto4.thumbnail.jpg" alt="masterphoto4.jpg" /></a></p>
<p>A really interesting project I&#8217;ve been doing at work is finally live after a little over a month in design and development. I am quite pleased with the result as it is a fully dynamic (with content management system on the way) all Flash, language extendable solution.</p>
<p>The language menu has had to be hidden from view for now. That&#8217;s because the site hasn&#8217;t been translated yet, but after the first one is in I will be enabling the language selection. From there, extending the site to other languages is a matter of translating and publishing through the CMS with no touching of neither FLA-files or XML needed.</p>
<p>A tricky part of this project was getting the site swf, which filles the entire browser, to scale to fit the browser window, but not so that it would crop the site without displaying scrollbars on smaller screens. The solution was a little javascript that I <a href="http://www.oyvindnordhagen.com/blog/2008/01/08/flash-javascript-resizer-fill-the-browser-window-without-cropping/">published in an earlier post.</a></p>
<p>MasterPhoto captures stills and video by using model helicopters to reach heights and angles unmatched withother types of equipment. The results they can achieve is really stunning. Check out the site!</p>
<p><a href="http://www.masterphoto.no" target="_blank">www.masterphoto.no</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oyvindnordhagen.com/blog/2008/02/06/masterphotono-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
