<?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"
	>

<channel>
	<title>Dave Keen</title>
	<atom:link href="http://www.actionscriptdeveloper.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.actionscriptdeveloper.co.uk</link>
	<description>Professional and reliable UK based Actionscript development</description>
	<pubDate>Tue, 20 Jul 2010 22:31:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Flextrine 0.5.3 released</title>
		<link>http://www.actionscriptdeveloper.co.uk/flextrine-053-released/</link>
		<comments>http://www.actionscriptdeveloper.co.uk/flextrine-053-released/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 22:28:43 +0000</pubDate>
		<dc:creator>devdave</dc:creator>
		
		<category><![CDATA[AMFPHP]]></category>

		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Flex 3]]></category>

		<category><![CDATA[Flex 4]]></category>

		<category><![CDATA[Flextrine]]></category>

		<category><![CDATA[Object Oriented Design]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[0.5.3]]></category>

		<category><![CDATA[doctrine 2]]></category>

		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://www.actionscriptdeveloper.co.uk/flextrine-053-released/</guid>
		<description><![CDATA[As we approach the official release date I have made available another version of Flextrine.&#160; This release adds no new functionality but upgrades various elements of the codebase to be compatible with the trunk of Doctrine 2.&#160; If you are running against 2.0.0BETA2 this upgrade will have no effect, but if you are running against [...]]]></description>
			<content:encoded><![CDATA[<p>As we approach the official release date I have made available another version of Flextrine.&#160; This release adds no new functionality but upgrades various elements of the codebase to be compatible with the trunk of Doctrine 2.&#160; If you are running against 2.0.0BETA2 this upgrade will have no effect, but if you are running against the trunk of Doctrine (via git) you require 0.5.3.</p>
<p>Flextrine 0.5.3 remains fully compatible with all previous versions of Doctrine 2.</p>
<p>Flextrine is available from <a href="http://www.flextrine.com">www.flextrine.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.actionscriptdeveloper.co.uk/flextrine-053-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flextrine 0.5.1 released</title>
		<link>http://www.actionscriptdeveloper.co.uk/flextrine-051-released/</link>
		<comments>http://www.actionscriptdeveloper.co.uk/flextrine-051-released/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 09:27:53 +0000</pubDate>
		<dc:creator>devdave</dc:creator>
		
		<category><![CDATA[AMFPHP]]></category>

		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Flex 3]]></category>

		<category><![CDATA[Flex 4]]></category>

		<category><![CDATA[Flextrine]]></category>

		<category><![CDATA[Object Oriented Design]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[AMF]]></category>

		<category><![CDATA[doctrine 2]]></category>

		<category><![CDATA[flex orm]]></category>

		<category><![CDATA[flextine 0.5.1]]></category>

		<category><![CDATA[flextrine 0.5]]></category>

		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://www.actionscriptdeveloper.co.uk/flextrine-051-released/</guid>
		<description><![CDATA[Flextrine 0.5.1 has been released.&#160; The main thing that has been added is proper support for type mapping and Flextrine now supports all column types, including ‘date’ and ‘datetime’.&#160; It also has some bug fixes.
You can pick it up at www.flextrine.com
]]></description>
			<content:encoded><![CDATA[<p>Flextrine 0.5.1 has been released.&#160; The main thing that has been added is proper support for type mapping and Flextrine now supports all column types, including ‘date’ and ‘datetime’.&#160; It also has some bug fixes.</p>
<p>You can pick it up at <a href="http://www.flextrine.com">www.flextrine.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.actionscriptdeveloper.co.uk/flextrine-051-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting AMFPHP to turn NaN into null</title>
		<link>http://www.actionscriptdeveloper.co.uk/getting-amfphp-to-turn-nan-into-null/</link>
		<comments>http://www.actionscriptdeveloper.co.uk/getting-amfphp-to-turn-nan-into-null/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 16:45:52 +0000</pubDate>
		<dc:creator>devdave</dc:creator>
		
		<category><![CDATA[AMFPHP]]></category>

		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Flex 3]]></category>

		<category><![CDATA[Flex 4]]></category>

		<category><![CDATA[Object Oriented Design]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[amfbasedeserializer]]></category>

		<category><![CDATA[deserialization]]></category>

		<category><![CDATA[nan]]></category>

		<category><![CDATA[not a number]]></category>

		<category><![CDATA[number]]></category>

		<category><![CDATA[readDouble]]></category>

		<category><![CDATA[serialization]]></category>

		<guid isPermaLink="false">http://www.actionscriptdeveloper.co.uk/getting-amfphp-to-turn-nan-into-null/</guid>
		<description><![CDATA[Annoyingly the NaN (not a number) value of Number objects in AS3 is often quite hard to translate into a server-side equivalent and ends up breaking AMFPHP, and apparently BlazeDS too.
Here is a simple modification that will make AMFPHP turn NaN into a PHP null value on de-serialization.&#160; Unfortunately on the return journey – trying [...]]]></description>
			<content:encoded><![CDATA[<p>Annoyingly the NaN (not a number) value of Number objects in AS3 is often quite hard to translate into a server-side equivalent and ends up breaking AMFPHP, and apparently BlazeDS too.</p>
<p>Here is a simple modification that will make AMFPHP turn NaN into a PHP null value on de-serialization.&#160; Unfortunately on the return journey – trying to return NaN to AS3 – there doesn’t seem to be anything clever that can be done and the Flash Player insists on turning undefined numbers into 0.&#160; A glance through the AMF spec doesn’t reveal anything useful, and if you need this functionality you are best off creating a custom class wrapping the value of the number and including a isNotANumber:Boolean or something that you can examine and set on the server.</p>
<p>Anyway, here’s the code.&#160; In AMFBaseDeserializer.php find the following function:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">function</span> readDouble() {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum2" style="color: #606060">   2:</span>     $bytes = substr($this-&gt;raw_data, $this-&gt;current_byte, 8);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum3" style="color: #606060">   3:</span>     $this-&gt;current_byte += 8;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum4" style="color: #606060">   4:</span>     <span style="color: #0000ff">if</span> ($this-&gt;isBigEndian) {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum5" style="color: #606060">   5:</span>          $bytes = strrev($bytes);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum6" style="color: #606060">   6:</span>     } </pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum7" style="color: #606060">   7:</span>     $zz = unpack(<span style="color: #006080">&quot;dflt&quot;</span>, $bytes); <span style="color: #008000">// unpack the bytes</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum8" style="color: #606060">   8:</span>     </pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum9" style="color: #606060">   9:</span>     <span style="color: #0000ff">return</span> $zz[<span style="color: #006080">'flt'</span>]; <span style="color: #008000">// return the number from the associative array</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum10" style="color: #606060">  10:</span> } </pre>
<p><!--CRLF--></div>
</div>
<p>and change the last line so it reads:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #0000ff">function</span> readDouble() {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum2" style="color: #606060">   2:</span>     $bytes = substr($this-&gt;raw_data, $this-&gt;current_byte, 8);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum3" style="color: #606060">   3:</span>     $this-&gt;current_byte += 8;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum4" style="color: #606060">   4:</span>     <span style="color: #0000ff">if</span> ($this-&gt;isBigEndian) {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum5" style="color: #606060">   5:</span>          $bytes = strrev($bytes);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum6" style="color: #606060">   6:</span>     } </pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum7" style="color: #606060">   7:</span>     $zz = unpack(<span style="color: #006080">&quot;dflt&quot;</span>, $bytes); <span style="color: #008000">// unpack the bytes</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum8" style="color: #606060">   8:</span>     </pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum9" style="color: #606060">   9:</span>     <span style="color: #0000ff">return</span> ($zz[<span style="color: #006080">'flt'</span>] != <span style="color: #006080">&#8216;NAN&#8217;</span>) ? $zz[<span style="color: #006080">'flt'</span>] : <span style="color: #0000ff">null</span>; <span style="color: #008000">// return the number from the associative array</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum10" style="color: #606060">  10:</span> } </pre>
<p><!--CRLF--></div>
</div>
<p>Hope that helps someone!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.actionscriptdeveloper.co.uk/getting-amfphp-to-turn-nan-into-null/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flextrine chosen for elevator pitch at Flash on the Beach 2010!</title>
		<link>http://www.actionscriptdeveloper.co.uk/flextrine-chosen-for-elevator-pitch-at-flash-on-the-beach-2010/</link>
		<comments>http://www.actionscriptdeveloper.co.uk/flextrine-chosen-for-elevator-pitch-at-flash-on-the-beach-2010/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 22:25:03 +0000</pubDate>
		<dc:creator>devdave</dc:creator>
		
		<category><![CDATA[AMFPHP]]></category>

		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[FlashDevelop]]></category>

		<category><![CDATA[Flex 3]]></category>

		<category><![CDATA[Flex 4]]></category>

		<category><![CDATA[Flextrine]]></category>

		<category><![CDATA[Misc]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[brighton]]></category>

		<category><![CDATA[doctrine]]></category>

		<category><![CDATA[flash on the beach]]></category>

		<category><![CDATA[fotb]]></category>

		<category><![CDATA[fotb 2010]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://www.actionscriptdeveloper.co.uk/flextrine-chosen-for-elevator-pitch-at-flash-on-the-beach-2010/</guid>
		<description><![CDATA[My open source ORM project Flextrine has been chosen as one of 20 projects to present at this years Flash on the Beach, in Brighton this September.&#160; I get three hectic minutes to showcase Flextrine and try and demonstrate what it can do  
If you find yourself at Flash on the Beach this year [...]]]></description>
			<content:encoded><![CDATA[<p>My open source ORM project Flextrine has been chosen as one of 20 projects to present at this years Flash on the Beach, in Brighton this September.&#160; I get three hectic minutes to showcase Flextrine and try and demonstrate what it can do <img src='http://www.actionscriptdeveloper.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If you find yourself at Flash on the Beach this year come down and listen!</p>
<p><a href="http://www.flashonthebeach.com/sessions/index.php?pageid=2999">http://www.flashonthebeach.com/sessions/index.php?pageid=2999</a>    <br /><a title="http://code.google.com/p/flextrine2/" href="http://code.google.com/p/flextrine2/">http://code.google.com/p/flextrine2/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.actionscriptdeveloper.co.uk/flextrine-chosen-for-elevator-pitch-at-flash-on-the-beach-2010/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flextrine 0.5 released!</title>
		<link>http://www.actionscriptdeveloper.co.uk/flextrine-05-released/</link>
		<comments>http://www.actionscriptdeveloper.co.uk/flextrine-05-released/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 21:29:59 +0000</pubDate>
		<dc:creator>devdave</dc:creator>
		
		<category><![CDATA[AMFPHP]]></category>

		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[FlashDevelop]]></category>

		<category><![CDATA[Flex 3]]></category>

		<category><![CDATA[Flex 4]]></category>

		<category><![CDATA[Flextrine]]></category>

		<category><![CDATA[Object Oriented Design]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[associations]]></category>

		<category><![CDATA[database]]></category>

		<category><![CDATA[doctrine]]></category>

		<category><![CDATA[doctrine 2]]></category>

		<category><![CDATA[DQL]]></category>

		<category><![CDATA[many to one]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[one to many]]></category>

		<category><![CDATA[one to one]]></category>

		<category><![CDATA[orm]]></category>

		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.actionscriptdeveloper.co.uk/flextrine-05-released/</guid>
		<description><![CDATA[I have released the first public version of Flextrine.&#160; Its actually pretty feature rich, and I will be focusing mainly on bug fixes and stability as reports start to come back from the community leading up to the main release on 1st September.
Major features that have made it into 0.5:

Entities and the entity manager
Single and [...]]]></description>
			<content:encoded><![CDATA[<p>I have released the first public version of Flextrine.&#160; Its actually pretty feature rich, and I will be focusing mainly on bug fixes and stability as reports start to come back from the community leading up to the main release on 1st September.</p>
<p>Major features that have made it into 0.5:</p>
<ul>
<li>Entities and the entity manager</li>
<li>Single and collection associations</li>
<li>The Flextrine Manager</li>
<li>AS3 code generation</li>
<li>Lazy loading, requireOne and requireMany</li>
<li>Full Flex databinding</li>
<li>DQL queries</li>
</ul>
<p>Flextrine can be downloaded from Google Code at <a title="http://code.google.com/p/flextrine2/" href="http://code.google.com/p/flextrine2/">http://code.google.com/p/flextrine2/</a>&#160; Please try it out and log any issue you might find in Google Code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.actionscriptdeveloper.co.uk/flextrine-05-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Transforming ArrayCollection data using a map function to keep your view seperated in an MVC app</title>
		<link>http://www.actionscriptdeveloper.co.uk/transforming-arraycollection-data-using-a-map-function-to-keep-your-view-seperated-in-an-mvc-app/</link>
		<comments>http://www.actionscriptdeveloper.co.uk/transforming-arraycollection-data-using-a-map-function-to-keep-your-view-seperated-in-an-mvc-app/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 11:08:00 +0000</pubDate>
		<dc:creator>devdave</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Flex 3]]></category>

		<category><![CDATA[Flex 4]]></category>

		<category><![CDATA[Object Oriented Design]]></category>

		<category><![CDATA[PureMVC]]></category>

		<category><![CDATA[arraycollection]]></category>

		<category><![CDATA[COLLECTION_CHANGE]]></category>

		<category><![CDATA[databinding]]></category>

		<category><![CDATA[dataprovider]]></category>

		<category><![CDATA[filterFunction]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[listcollectionview]]></category>

		<category><![CDATA[mapFunction]]></category>

		<category><![CDATA[mate]]></category>

		<category><![CDATA[MVC]]></category>

		<category><![CDATA[robotlegs]]></category>

		<category><![CDATA[swiz]]></category>

		<category><![CDATA[transform]]></category>

		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">http://www.actionscriptdeveloper.co.uk/transforming-arraycollection-data-using-a-map-function-to-keep-your-view-seperated-in-an-mvc-app/</guid>
		<description><![CDATA[Last night I was working on a project which involved me having to display large amounts of data in a Flex list.  However, this data needed to be transformed before being displayed.  Let me explain with a simplified example.
The problem
Suppose we need to display a huge list of Result objects, where a Result object contains [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I was working on a project which involved me having to display large amounts of data in a Flex list.  However, this data needed to be transformed before being displayed.  Let me explain with a simplified example.</p>
<h2><span style="text-decoration: underline;">The problem</span></h2>
<p>Suppose we need to display a huge list of Result objects, where a Result object contains a <em>score </em>property (lets say it is a Number).  If we just need to display the number then we provide the <a title="ArrayCollection" href="http://livedocs.adobe.com/flex/3/langref/mx/collections/ArrayCollection.html" target="_blank">ArrayCollection</a> of Results as the <strong>dataProvider</strong> to the list and set the <strong>dataField</strong> to ‘score’ and everything is nice and easy.  Now suppose that we need to do some kind of calculation on score – for example, we need to divide it by 2 before displaying it.  Again, this is no problem; we use the <strong>labelFunction</strong> in the list and add a callback function in the MXML file that divides the score by two before returning it:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: 'Courier New', courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   1:</span> <span style="color: #0000ff;">private</span> function labelFunction(item:Object):String {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   2:</span>     var result:Result = item as Result;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   3:</span>     <span style="color: #0000ff;">return</span> result.score / 2;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   4:</span> }</pre>
<p><!--CRLF--></p>
</div>
</div>
<p>This is all fine.</p>
<p>Now lets suppose that we need to transform the score in a more complicated way – imagine that we are writing some kind of multiuser application and we need to divide the score by the number of users currently logged on to the application before displaying it in the list.  At this point I should point out that I tend to use <a title="PureMVC" href="http://puremvc.org/" target="_blank">PureMVC</a> so I will explain this using <a title="PureMVC" href="http://puremvc.org/" target="_blank">PureMVC</a> terminology, but its equally applicable to all other MVC frameworks (<a title="Mate" href="http://mate.asfusion.com/" target="_blank">Mate</a>, <a title="Swiz" href="http://swizframework.org/" target="_blank">Swiz</a>, <a title="Robotlegs" href="http://www.robotlegs.org/" target="_blank">Robotlegs</a>, etc).</p>
<p>Lets assume that the number of users logged on is in our Model tier; we then have a couple of options on how to go about this:</p>
<p><strong>Inject the number of users into the view from our mediator and continue to use labelFunction.</strong></p>
<ol>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: 'Courier New', courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   1:</span> <span style="color: #0000ff;">public</span> var userCount:Number;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   2:</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   3:</span> <span style="color: #0000ff;">private</span> function labelFunction(item:Object):String {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   4:</span>     var result:Result = item as Result;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   5:</span>     <span style="color: #0000ff;">return</span> results.score / userCount;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   6:</span> }</pre>
<p><!--CRLF--></p>
</div>
</div>
</ol>
<p>This is an ok solution – it doesn’t break MVC encapsulation and it works fine.  However, the drawbacks are that we need to monitor when userCount changes and each time re-inject it into the view (and tell the list to update itself).  But the main problem with this is that it gives our view knowledge of something that it shouldn’t know about.</p>
<p><strong>Extend Result to do the calculation itself</strong></p>
<p>We can add a getter to Result that does the calculation which means we can get rid of labelFunction in the view and just set dataField to the getter (e.g. <strong>dataField=”transformedScore”</strong>).  But this just moves the problem elsewhere; now the Result object will need to know the number of users; we’d either have to inject it in via a static variable, or give the Result object knowledge of the MVC framework.  This solution is in fact much worse than our first effort.</p>
<p><strong>Pre-build the ArrayCollection with transformed scores</strong></p>
<p>In this method we iterate through the Results, doing our calculation on score each time and building up a new dataprovider.  This is fine from an MVC perspective; the view gets its data fully formed in the format it requires, and since the mediator is building the list there is no problem with it querying the model tier.  However, this is a bad solution for other reasons; say that you have 5000 Result objects; the mediator will need to iterate through the entire list before passing the new collection to the view, incurring a nasty performance hit.  Furthermore we will need to rebuild this list entirely if the score or the number of logged in users change.</p>
<h2><span style="text-decoration: underline;">The solution</span></h2>
<p>Here, at last, is my solution to the problem.  Like all good solutions it is disarmingly simple <img src='http://www.actionscriptdeveloper.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: 'Courier New', courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   1:</span> <span style="color: #0000ff;">package</span> org.davekeen.collections {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   2:</span>     <span style="color: #0000ff;">import</span> mx.collections.IList;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   3:</span>     <span style="color: #0000ff;">import</span> mx.collections.ListCollectionView;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   4:</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   5:</span>     <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> MappedListCollectionView <span style="color: #0000ff;">extends</span> ListCollectionView {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   6:</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   7:</span>         <span style="color: #0000ff;">public</span> var mapFunction:Function;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   8:</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   9:</span>         <span style="color: #0000ff;">public</span> function MappedListCollectionView(list:IList = null) {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">  10:</span>             <span style="color: #0000ff;">super</span>(list);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">  11:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">  12:</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">  13:</span>         override <span style="color: #0000ff;">public</span> function getItemAt(index:<span style="color: #0000ff;">int</span>, prefetch:<span style="color: #0000ff;">int</span> = 0):Object {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">  14:</span>             <span style="color: #0000ff;">if</span> (mapFunction == null) {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">  15:</span>                 <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">super</span>.getItemAt(index, prefetch);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">  16:</span>             } <span style="color: #0000ff;">else</span> {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">  17:</span>                 <span style="color: #0000ff;">return</span> mapFunction(<span style="color: #0000ff;">super</span>.getItemAt(index, prefetch));</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">  18:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">  19:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">  20:</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">  21:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">  22:</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">  23:</span> }</pre>
<p><!--CRLF--></p>
</div>
</div>
<p>MappedListCollectionView extends the normal ListCollectionView (which is the superclass of ArrayCollection) adding a single property – mapFunction – which transforms an item of the array collection into another item.  So now we can do the following in the mediator:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: 'Courier New', courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   1:</span> <span style="color: #0000ff;">var</span> mappedListCollectionView:MappedListCollectionView = <span style="color: #0000ff;">new</span> MappedListCollectionView(resultsArrayCollection);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   2:</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   3:</span> mappedListCollectionView.mapFunction = <span style="color: #0000ff;">function</span>(item:Object):String {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   4:</span>     <span style="color: #0000ff;">var</span> userCount:Number = getUserCountFromModel();</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   5:</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   6:</span>     <span style="color: #0000ff;">var</span> result:Result = item <span style="color: #0000ff;">as</span> Result;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   7:</span>     <span style="color: #0000ff;">return</span> result.score / userCount;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">   8:</span> }</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #606060;">   9:</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #606060;">  10:</span> myView.myList.dataProvider = mappedListCollectionView;</pre>
<p><!--CRLF--></p>
</div>
</div>
<p>I think this is an excellent solution – it maintains encapsulation within the view, it follows Flex standards (in that its syntax is the same as filterFunction), it will work with Flex binding and COLLECTION_CHANGE events and best of all it is high performance as mapFunction is only called for the rows that are actually on the screen.</p>
<p>One thing to bear in mind when using this solution is that Flex databinding will only be triggered when elements of the array collection itself change, so if userCount changes you will need to manually dispatch a COLLECTION_CHANGE event on the array collection.</p>
<p>Hope you find this as useful as I do!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.actionscriptdeveloper.co.uk/transforming-arraycollection-data-using-a-map-function-to-keep-your-view-seperated-in-an-mvc-app/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Announcement of Flextrine 2</title>
		<link>http://www.actionscriptdeveloper.co.uk/announcement-of-flextrine-2/</link>
		<comments>http://www.actionscriptdeveloper.co.uk/announcement-of-flextrine-2/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 23:49:32 +0000</pubDate>
		<dc:creator>devdave</dc:creator>
		
		<category><![CDATA[AMFPHP]]></category>

		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Flex 3]]></category>

		<category><![CDATA[Flex 4]]></category>

		<category><![CDATA[Flextrine]]></category>

		<category><![CDATA[Object Oriented Design]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[as3 class mapping]]></category>

		<category><![CDATA[database]]></category>

		<category><![CDATA[doctrine 2]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[flextirine]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://www.actionscriptdeveloper.co.uk/announcement-of-flextrine-2/</guid>
		<description><![CDATA[
I am most proud to announce the development and upcoming release of Flextrine – an open source project I am developing that simplifies and encapsulates ORM with Flex and PHP.  Very simply, Flextrine maps AS3 objects to database tables giving you the ability to save and load objects to a remote database without having to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.actionscriptdeveloper.co.uk/images/flextrine/flextrine_bar.png" alt="" /></p>
<p>I am most proud to announce the development and upcoming release of Flextrine – an open source project I am developing that simplifies and encapsulates ORM with Flex and PHP.  Very simply, Flextrine maps AS3 objects to database tables giving you the ability to save and load objects to a remote database without having to worry about any server coding.  It supports all usual associations, local caching, indexing, Flex databinding and many other things, as well as having a nifty web interface for generating schemas and stubs.</p>
<p>Flextrine is planned for release on 1st September to match the release of its parent project Doctrine 2.</p>
<p>Check out <a title="http://code.google.com/p/flextrine2/" href="http://code.google.com/p/flextrine2/">http://code.google.com/p/flextrine2/</a> for more details.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.actionscriptdeveloper.co.uk/announcement-of-flextrine-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Adobe, Apple, iPhones, iPads and the Flash Player &#8211; my two cents</title>
		<link>http://www.actionscriptdeveloper.co.uk/adobe-apple-iphones-ipads-and-the-flash-player-my-two-cents/</link>
		<comments>http://www.actionscriptdeveloper.co.uk/adobe-apple-iphones-ipads-and-the-flash-player-my-two-cents/#comments</comments>
		<pubDate>Sat, 08 May 2010 12:17:30 +0000</pubDate>
		<dc:creator>devdave</dc:creator>
		
		<category><![CDATA[Actionscript 2.0]]></category>

		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Freelance]]></category>

		<category><![CDATA[Misc]]></category>

		<category><![CDATA[Object Oriented Design]]></category>

		<category><![CDATA[adobe]]></category>

		<category><![CDATA[apple]]></category>

		<category><![CDATA[avm]]></category>

		<category><![CDATA[avm2]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[flash platform]]></category>

		<category><![CDATA[flash player]]></category>

		<category><![CDATA[html 5]]></category>

		<category><![CDATA[html canvas]]></category>

		<category><![CDATA[ipad]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[os x]]></category>

		<category><![CDATA[sue]]></category>

		<guid isPermaLink="false">http://www.actionscriptdeveloper.co.uk/adobe-apple-iphones-ipads-and-the-flash-player-my-two-cents/</guid>
		<description><![CDATA[There have been some nasty fights recently between Apple and Adobe regarding allowing the Flash Player to run on mobile Apple platforms, which is starting to descend into massive criticism of the Flash platform itself.&#160; I guess its obvious which side of the debate I am going to be on and here is some of [...]]]></description>
			<content:encoded><![CDATA[<p>There have been some nasty fights recently between Apple and Adobe regarding allowing the Flash Player to run on mobile Apple platforms, which is starting to descend into massive criticism of the Flash platform itself.&#160; I guess its obvious which side of the debate I am going to be on and here is some of my reasoning:</p>
<ul>
<li>One part of Apple’s beef with Flash is that it munches performance and battery.&#160; In fact, Flash isn’t inherently a CPU hog, but is a flexible and powerful tool which means that a coder who doesn’t optimize his code well can end up using more resources than they need to.&#160; Apple seem to think that HTML 5 canvas and Javascript will somehow perform better, but it seems pretty obvious to me that bad (or high performance) code in HTML is going to munch just as many resources as its equivalent Flash app.&#160; As a case in point check out the very cool JSNES HTML emulator at <a title="http://benfirshman.com/projects/jsnes/" href="http://benfirshman.com/projects/jsnes/">http://benfirshman.com/projects/jsnes/</a> – its an awesome project, but just listen to your fan step up as it runs… </li>
<li>Another of Apple’s problems is that Flash is a closed platform.&#160; Its true, and I as much as anyone would be happy to see the AVM open up; however, Apple are being pretty hypocritical here – the iPhone/iPad platform (as opposed to Android) is also completely closed.&#160; Furthermore Apple own patents in H.264 (the video codec they are promoting in concert with HTML 5 as the replacement for Flash video) and stand to make a mint out of their ‘open’ replacement.&#160; This sounds like a business tactic to me, rather than any high morals to advance the open source community. </li>
<li>As a case in point Apple are quick to mention that even on high powered OS X machines Flash performs badly.&#160; Well, the main reason for this is that Apple block access to certain API required for higher performance, no doubt so that they can then claim that Flash performs badly on high powered OS X machines. </li>
<li>In almost all the chat around the web Apple seem to be complaining about one thing (although without specifically saying it); streaming video.&#160; Flash is of course used heavily to deliver video and streaming over the web, but this is a tiny part of what Flash can and does do.&#160; What about Flex, RIAs, applications, etc?&#160; Flash is a fully featured platform which happens to be ok at delivering video but by taking this stance Apple will be blocking everything else that is good about Flash. </li>
</ul>
<p>Apple seem to think that everything that Flash can do will be replicable in HTML 5 using Canvas, Javascript and CSS.&#160; Even apart from the fact that HTML 5 does not have anything like the feature set of the AVM, lets think about this from a developer perspective for a second and we can pretty quickly see some of the downfalls:</p>
<ul>
<li>Javascript is one of the most horrible programming languages about; in fact its the same as Actionscript 1 which was released in 2000 and then outdated in 2003.&#160; The thought of developing fully featured RIAs in AS1 is horrible! </li>
<li>Despite the fact that HTML 5 is a standard, history strongly suggests that its going to perform differently in IE, Firefox, Safari, Opera and every other browser increasing development and maintenance time.&#160; Flash is a plugin, and although this certainly has its negative points at least you can be sure that it will do the same thing in every browser and platform. </li>
<li>If there is a bug in the Flash Player, Adobe release a new version which updates itself from within the player.&#160; Imagine if something turns out to be wrong with HTML 5?&#160; Its a standard which means that the bug fix will need to be implemented as a upgrade to the standard, then <strong>every</strong> browser will need to implement the update off their own steam.&#160; We will certainly end up with a situation where browsers support different states of HTML 5 at the same time.&#160; Adding new features will face a similar issue. </li>
</ul>
<p>The whole thing feels like Apple playing off consumer loyalties and technical ignorance to try and control as much of the web as they can.&#160; I believe that ultimately this will result either in developers falling away from the Apple mobile platform in favour of devices that support the cross-platform model which will end up damaging their business model.&#160; At which point, no doubt, Flash will suddenly be supported again <img src='http://www.actionscriptdeveloper.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.actionscriptdeveloper.co.uk/adobe-apple-iphones-ipads-and-the-flash-player-my-two-cents/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Catalyst with FlashDevelop</title>
		<link>http://www.actionscriptdeveloper.co.uk/using-catalyst-with-flashdevelop/</link>
		<comments>http://www.actionscriptdeveloper.co.uk/using-catalyst-with-flashdevelop/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 14:42:20 +0000</pubDate>
		<dc:creator>devdave</dc:creator>
		
		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[FlashDevelop]]></category>

		<category><![CDATA[Flex 4]]></category>

		<category><![CDATA[ai]]></category>

		<category><![CDATA[catalyst]]></category>

		<category><![CDATA[fxp]]></category>

		<category><![CDATA[macros]]></category>

		<category><![CDATA[psd]]></category>

		<category><![CDATA[skinning]]></category>

		<guid isPermaLink="false">http://www.actionscriptdeveloper.co.uk/using-catalyst-with-flashdevelop/</guid>
		<description><![CDATA[Adobe have just released the first version of Catalyst, a great addition to the Adobe suite which addresses the long-standing annoyances of skinning Flex applications.&#160; Basically Catalyst allows you to take a PSD or AI file, chop it up into Flex components, optionally add some interactions and then export the whole shebang info Flash Builder [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe have just released the first version of <a title="Catalyst" href="http://www.adobe.com/products/flashcatalyst/" target="_blank">Catalyst</a>, a great addition to the Adobe suite which addresses the long-standing annoyances of skinning Flex applications.&#160; Basically Catalyst allows you to take a PSD or AI file, chop it up into Flex components, optionally add some interactions and then export the whole shebang info Flash Builder 4 so you can start coding.&#160; However, Catalyst only wants to save a Flash Builder readable FXP file which is no use for the likes of us who use FlashDevelop.&#160; Luckily it turns out that FXP files are just normal zips of the Flash Builder code tree, so we can extract the assets into a FlashDevelop project using a simple script.&#160; Note that you will need to download <a href="http://stahlworks.com/dev/index.php?tool=zipunzip" target="_blank">unzip.exe</a> and put it into your path for this to work.</p>
<p>First of all create a folder called ‘fxp’ in the root level of your FlashDevelop project.&#160; Then save your Catalyst project to this project (you can call it anything as long as it has an fxp extension).&#160; Then create a text file, also in the root of your project called <strong>ExtractCatalystProject.bat</strong> and put the following code into it:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> unzip.exe fxp/*.fxp -x html-template/* .* libs/* src/PrivateData.mxml mimetype</pre>
<p><!--CRLF--></div>
</div>
<p>Now to import the Catalyst project into your application right click on the bat file and choose ‘Execute’.&#160; Every time you make a graphical change in Catalyst run the script again to extract.&#160; Obviously you’ll have to be careful not to make any changes to the generated code in FlashDevelop otherwise it will get overwritten next time you extract.</p>
<p>Obviously this is a very simple solution and there are certainly better ways to do this (C# script macro anyone?), but as a first solution this seems to work ok <img src='http://www.actionscriptdeveloper.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.actionscriptdeveloper.co.uk/using-catalyst-with-flashdevelop/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AMFPHP, PHP 5.3 and namespaces</title>
		<link>http://www.actionscriptdeveloper.co.uk/amfphp-php-53-and-namespaces/</link>
		<comments>http://www.actionscriptdeveloper.co.uk/amfphp-php-53-and-namespaces/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 16:25:06 +0000</pubDate>
		<dc:creator>devdave</dc:creator>
		
		<category><![CDATA[AMFPHP]]></category>

		<category><![CDATA[Actionscript 3.0]]></category>

		<category><![CDATA[Flex 3]]></category>

		<category><![CDATA[Object Oriented Design]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[AMF]]></category>

		<category><![CDATA[amfphp class mapping]]></category>

		<category><![CDATA[flash remoting]]></category>

		<category><![CDATA[mapclass]]></category>

		<category><![CDATA[namespaces]]></category>

		<category><![CDATA[php 5.3]]></category>

		<category><![CDATA[php namespace]]></category>

		<category><![CDATA[value objects]]></category>

		<guid isPermaLink="false">http://www.actionscriptdeveloper.co.uk/amfphp-php-53-and-namespaces/</guid>
		<description><![CDATA[I spent a very frustrating day discovering that AMFPHP (trunk) doesn’t support class mapping to PHP classes that exist in the brand new PHP 5.3 namespaces.&#160; So, if you happen to have the following class mapping:


   1: namespace vo;

   2:&#160; 

   3: class User {

   4:  [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a very frustrating day discovering that AMFPHP (trunk) doesn’t support class mapping to PHP classes that exist in the brand new PHP 5.3 namespaces.&#160; So, if you happen to have the following class mapping:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> namespace vo;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum2" style="color: #606060">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum3" style="color: #606060">   3:</span> <span style="color: #0000ff">class</span> User {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum4" style="color: #606060">   4:</span>     $_explicitType = <span style="color: #006080">&quot;vo.User&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum5" style="color: #606060">   5:</span> }</pre>
<p><!--CRLF--></div>
</div>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> package vo;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum2" style="color: #606060">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum3" style="color: #606060">   3:</span> [RemoteClass(alias=<span style="color: #006080">&quot;vo.User&quot;</span>)]</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum4" style="color: #606060">   4:</span> <span style="color: #0000ff">class</span> User {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum5" style="color: #606060">   5:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum6" style="color: #606060">   6:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>… AMFPHP won’t pick up the fact that these are supposed to be the same class and will create an associative array when you send User as a parameter to a service.&#160; It works fine in the opposite direction (i.e. returning User back to AS3 is ok).</p>
<p>I tried out <a title="ZendAMF" href="http://framework.zend.com/download/amf" target="_blank">ZendAMF</a> and <a title="WebORB for PHP" href="http://www.themidnightcoders.com/products/weborb-for-php/overview.html" target="_blank">WebORB for PHP</a>, but eventually decided that whilst they definitely have their merits, these frameworks are way too heavyweight for my application; ZendAMF requires the whole Zend Framework stack in order to work and WebORB is 22MB!&#160; Instead I set about patching AMFPHP to support namespaces.&#160; And here it is!</p>
<p>In <strong>amfphp/core/amf/io/AMFBaseSerializer.php </strong>change line 392 to:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> $classname = (strstr($typeIdentifier, <span style="color: #006080">&quot;/&quot;</span>)) ? str_replace(<span style="color: #006080">&quot;/&quot;</span>, &quot;\\&quot;, $typeIdentifier) : substr($mappedClass, $lastPlace);</pre>
<p><!--CRLF--></div>
</div>
<p>Then if you want to class map to a PHP class in a namespace instead of using . notation, put forward slashes (/).&#160; In fact PHP in its infinite wisdom uses backslashes (\) to delimit namespaces but as these denote escape characters terrible things happen when we start serializing strings and rather than have to escape the backslash all the time I just plumped for the forward slash.&#160; Therefore our example, which in PHP namespace notation refers to the class <strong>\vo\User</strong> would change to:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> namespace vo;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum2" style="color: #606060">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum3" style="color: #606060">   3:</span> <span style="color: #0000ff">class</span> User {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum4" style="color: #606060">   4:</span>     $_explicitType = <span style="color: #006080">&quot;/vo/User&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum5" style="color: #606060">   5:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>… and our AS3 class would become:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> package vo;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum2" style="color: #606060">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum3" style="color: #606060">   3:</span> [RemoteClass(alias=<span style="color: #006080">&quot;/vo/User&quot;</span>)]</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum4" style="color: #606060">   4:</span> <span style="color: #0000ff">class</span> User {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum5" style="color: #606060">   5:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum6" style="color: #606060">   6:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Tada!&#160; AS3 to PHP class mapping working as expected again!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.actionscriptdeveloper.co.uk/amfphp-php-53-and-namespaces/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
