<?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>ria-coder.com &#187; amfphp</title>
	<atom:link href="http://ria-coder.com/blog/tag/amfphp/feed" rel="self" type="application/rss+xml" />
	<link>http://ria-coder.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 21 Apr 2010 19:35:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Calling all PHP Rockstars!</title>
		<link>http://ria-coder.com/blog/calling-all-php-rockstars</link>
		<comments>http://ria-coder.com/blog/calling-all-php-rockstars#comments</comments>
		<pubDate>Wed, 21 Apr 2010 19:35:08 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[amfphp]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=595</guid>
		<description><![CDATA[We’re looking for some skilled PHP developers to help us innovate with and improve on AMFPHP. If you think you’ve got the goods to help us get this project insanely powerful (but still simple and easy to use), drop us a line!]]></description>
			<content:encoded><![CDATA[<div>
<p>Hey everyone</p>
<p>We’re looking for some skilled <acronym title="Hypertext Preprocessor">PHP</acronym> developers to help us innovate with and improve on AMFPHP. If you think you’ve got the goods to help us get this project insanely powerful (but still simple and easy to use), drop us a line!</p>
<ul>
<li>
<div>Ariel Sommeria-klein &#8211; Project Lead (<a title="ariel@amfphp.me" href="mailto:ariel@amfphp.me">ariel@amfphp.me</a>)</div>
</li>
<li>
<div>Danny Kopping &#8211; Development Lead (<a title="mailto:danny@amfphp.me" href="mailto:mailto:danny@amfphp.me">danny@amfphp.me</a>)</div>
</li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/calling-all-php-rockstars/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AMFPHP is back!</title>
		<link>http://ria-coder.com/blog/amfphp-is-back</link>
		<comments>http://ria-coder.com/blog/amfphp-is-back#comments</comments>
		<pubDate>Tue, 02 Feb 2010 13:29:49 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[amfphp 1.9]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=541</guid>
		<description><![CDATA[AMFPHP is back!]]></description>
			<content:encoded><![CDATA[<p>Today is a wonderful day!</p>
<p>I have teamed up with <a title="Ariel Sommeria" href="http://arielsommeria.com/blog/" target="_blank">Ariel Sommeria-klein</a> to revive the legendary <a title="AMFPHP" href="http://amfphp.sourceforge.net" target="_blank">AMFPHP</a> project that spawned a whole new dimension of Rich Internet Applications. Together we have brought <a title="AMFPHP 1.9" href="https://sourceforge.net/projects/amfphp/files/#files" target="_blank">AMFPHP 1.9</a> out of beta and made it compatible with PHP 5.3. We have also completely rewritten the AMFPHP service browser and we have several improvements planned for AMFPHP 2.0.</p>
<p>If you would like to help contribute to this great open-source application, please <a title="Contact Us!" href="http://amfphp.sourceforge.net/contact.html" target="_blank">contact us</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/amfphp-is-back/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>AMFPHP Genie v0.2</title>
		<link>http://ria-coder.com/blog/amfphp-genie-02</link>
		<comments>http://ria-coder.com/blog/amfphp-genie-02#comments</comments>
		<pubDate>Sun, 13 Dec 2009 23:35:56 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[amfphp genie]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=505</guid>
		<description><![CDATA[AMFPHP Genie (0.2) is a simple tool to help you get shit done using Flex and AMFPHP.]]></description>
			<content:encoded><![CDATA[<p>AMFPHP Genie (0.2) is a simple tool to help you get shit done using Flex and AMFPHP.</p>
<p>Check out <a title="AMFPHP Genie" href="http://dannykopping.co.za/amfphp-genie/">http://dannykopping.co.za/amfphp-genie/</a> for more information!</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/amfphp-genie-02/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flash &amp; Flex Developer&#039;s Magazine</title>
		<link>http://ria-coder.com/blog/flash-flex-developers-magazine</link>
		<comments>http://ria-coder.com/blog/flash-flex-developers-magazine#comments</comments>
		<pubDate>Wed, 02 Sep 2009 19:49:25 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[ffdmag]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=386</guid>
		<description><![CDATA[The new version of FFDMag is officially out! The publication is now an online-based magazine, available free of charge to all that want to check it out. Check out my article about Flex &#038; AMFPHP integration on Page 54.]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">The new version of FFDMag is officially out! The publication is now an online-based magazine, available free of charge to all that want to check it out.</p>
<p>Check out my article about Flex &amp; AMFPHP integration on Page 54&#8230;</p>
<p style="text-align: center;"><a href="http://www.ffdmag.com"><img class="aligncenter" style="margin-top: 5px; margin-bottom: 5px;" title="FFDMag 5" src="http://ffdmag.com//files/ffdmag/Cover/f&amp;f_magazine_05_2009.jpg" alt="" width="400" height="578" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/flash-flex-developers-magazine/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handling multiple remote services with RemoteObject &#8211; the easy way!</title>
		<link>http://ria-coder.com/blog/handling-multiple-remote-services-with-remoteobject-the-easy-way</link>
		<comments>http://ria-coder.com/blog/handling-multiple-remote-services-with-remoteobject-the-easy-way#comments</comments>
		<pubDate>Tue, 05 May 2009 22:16:03 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[FaultEvent]]></category>
		<category><![CDATA[remoteobject]]></category>
		<category><![CDATA[ResultEvent]]></category>
		<category><![CDATA[service calls]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=271</guid>
		<description><![CDATA[Here's a quick and easy way to handle multiple service calls in two simple event handlers!]]></description>
			<content:encoded><![CDATA[<p>Ok, so you&#8217;re developing a Flex application with a bit of server-side integration (using PHP, Java, Ruby, .NET, etc) and your application is getting a little intense; multiple service calls to the server, custom logic for success and failure of said calls and everything in between.</p>
<p>You could use the following syntax for handling mutliple method-calls from a remote script (in this example <em>MyService</em>):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RemoteObject</span> id=<span style="color: #ff0000;">&quot;service&quot;</span> destination=<span style="color: #ff0000;">&quot;amfphp&quot;</span> source=<span style="color: #ff0000;">&quot;MyService&quot;</span> makeObjectsBindable=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
 	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:method</span> name=<span style="color: #ff0000;">&quot;doSomething&quot;</span> result=<span style="color: #ff0000;">&quot;doSomethingResult(event)&quot;</span> fault=<span style="color: #ff0000;">&quot;doSomethingFault(event)&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
 	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:method</span> name=<span style="color: #ff0000;">&quot;doAnotherSomething&quot;</span> result=<span style="color: #ff0000;">&quot;doAnotherSomethingResult(event)&quot;</span> fault=<span style="color: #ff0000;">&quot;doAnotherSomethingFault(event)&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
 <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:RemoteObject</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;"> 	&lt;![CDATA[</span>
<span style="color: #339933;">		private function doSomethingResult(event:ResultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			// custom logic</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		private function doSomethingFault(event:FaultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			// custom logic</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		private function doAnotherSomethingResult(event:ResultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			// custom logic</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		private function doAnotherSomethingFault(event:FaultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			// custom logic</span>
<span style="color: #339933;">		}</span>
<span style="color: #339933;"> 	]]&gt;</span>
<span style="color: #339933;">&lt;/mx:Script&gt;</span></pre></td></tr></table></div>

<p>I dunno about you, but to have to define <strong>special</strong> tags in MXML for each bloody method in your script is too much effort (and can leave you with some nasty/tricky bugs if you forget to add a new tag after adding a new method in your server-side script!). I used the following mechanism in my post about <a title="Integrating CodeIgniter, Flex and PHP" href="http://ria-coder.com/blog/integrating-flex-amfphp-and-codeigniter-with-value-objects/" target="_blank">integrating CodeIgniter, Flex and PHP</a> if i remember correctly&#8230; Give me a break&#8230; I was too lazy to check (it&#8217;s midnight and i&#8217;m sleepless).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RemoteObject</span> id=<span style="color: #ff0000;">&quot;service&quot;</span> destination=<span style="color: #ff0000;">&quot;amfphp&quot;</span> source=<span style="color: #ff0000;">&quot;MyService&quot;</span> makeObjectsBindable=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">result=<span style="color: #ff0000;">&quot;resultHandler(event)&quot;</span> fault=<span style="color: #ff0000;">&quot;faultHandler(event)&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;"> 	&lt;![CDATA[</span>
<span style="color: #339933;">		private function resultHandler(event:ResultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			var message:RemotingMessage = event.token.message as RemotingMessage;</span>
&nbsp;
<span style="color: #339933;">			switch(message.operation)</span>
<span style="color: #339933;">			{</span>
<span style="color: #339933;">				case &quot;doSomething&quot;:</span>
<span style="color: #339933;">					// custom logic</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">				case &quot;doAnotherSomething&quot;:</span>
<span style="color: #339933;">					// custom logic</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">				default:</span>
<span style="color: #339933;">					trace(&quot;Shit... Missed this one... &quot; + message.operation);</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">			}</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		private function faultHandler(event:FaultEvent):void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			var message:RemotingMessage = event.token.message as RemotingMessage;</span>
&nbsp;
<span style="color: #339933;">			switch(message.operation)</span>
<span style="color: #339933;">			{</span>
<span style="color: #339933;">				case &quot;doSomething&quot;:</span>
<span style="color: #339933;">					// custom logic</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">				case &quot;doAnotherSomething&quot;:</span>
<span style="color: #339933;">					// custom logic</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">				default:</span>
<span style="color: #339933;">					trace(&quot;Shit... Missed this one... &quot; + message.operation);</span>
<span style="color: #339933;">					break;</span>
<span style="color: #339933;">			}</span>
<span style="color: #339933;">		}</span>
<span style="color: #339933;"> 	]]&gt;</span>
<span style="color: #339933;">&lt;/mx:Script&gt;</span></pre></td></tr></table></div>

<p>Seems much easier, doesn&#8217;t it? Essentially all you&#8217;re doing is examining the event parameter of the ResultEvent or FaultEvent, finding which method was just called and acting accordingly&#8230; This will work with any number of method calls, from any number of different RemoteObjects. You can point them all to the same handlers!</p>
<p>If you guys have any alternative ways of doing this, let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/handling-multiple-remote-services-with-remoteobject-the-easy-way/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Making your constructors more useful</title>
		<link>http://ria-coder.com/blog/making-your-constructors-more-useful</link>
		<comments>http://ria-coder.com/blog/making-your-constructors-more-useful#comments</comments>
		<pubDate>Mon, 30 Mar 2009 18:44:27 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[constructor]]></category>
		<category><![CDATA[flex remoting]]></category>
		<category><![CDATA[remoting]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=220</guid>
		<description><![CDATA[The constructor function in Object-Oriented languages is an incredibly useful mechanism to use, and we've all used them for a wide variety of solutions.]]></description>
			<content:encoded><![CDATA[<p>The constructor function in Object-Oriented languages is an incredibly useful mechanism to use, and we&#8217;ve all used them for a wide variety of solutions.</p>
<p>When i use PHP with Flex, i like taking advantage of AMFPHP&#8217;s amazingly nifty feature of being able to send whole objects as binary data to and from the server. This can be vastly useful because you could send a whole object from Flex as an ActionScript class and PHP will receive it and use it as the <em>same class</em>! Here&#8217;s a practical example:</p>
<p>You are making an application to control a university&#8217;s student details. One logical step would be to go and create a <em>Student class</em> in ActionScript 3.0:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Student
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> ID<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> firstName<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> surname<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> age<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> accountPaid<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Student<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>Now, if you&#8217;re using AMFPHP, it&#8217;d be a complete ball-ache to have to send the <em>Student</em> class like this (say you were inserting a student into the database):</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> student<span style="color: #000000; font-weight: bold;">:</span>Student = <span style="color: #0033ff; font-weight: bold;">new</span> Student<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
student.firstName = <span style="color: #990000;">&quot;Jacob&quot;</span>;
student.surname = <span style="color: #990000;">&quot;Zuma&quot;</span>;
student.age = <span style="color: #000000; font-weight:bold;">67</span>;
student.accountPaid = <span style="color: #0033ff; font-weight: bold;">false</span>;
&nbsp;
service.addStudent<span style="color: #000000;">&#40;</span>student.firstName, student.surname, student.age, student.accountPaid<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>Wouldn&#8217;t it be so much easier to simply do this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">service.addStudent<span style="color: #000000;">&#40;</span>student<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>&#8230;and receive the object in PHP, and serialize it into this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #000000; font-weight: bold;">class</span> Student
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$ID</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$firstName</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$surname</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$age</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$accountPaid</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Well, it&#8217;s possible! I covered this is some detail in one of my <a title="Integrating Flex, AMFPHP and CodeIgniter (also including Value-Objects)" href="http://ria-coder.com/blog/integrating-flex-amfphp-and-codeigniter-with-value-objects/" target="_blank">previous tutorial</a>s, and Flex-to-PHP remoting is not in the scope of this particular post. The focus of this post, however, is to give you a couple of tips as to making your constructors more intelligent in the realm of Flex remoting. My two main areas of web development are ActionScript 3.0 and PHP5, but you can easily apply the same logic that follows to all other Object-Oriented languages.</p>
<p>Below is the improvement on my earlier <em>Student</em> class, with the more remoting-friendly constructor:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span>.<span style="color: #004993;">describeType</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Student
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> ID<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> firstName<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> surname<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> age<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> accountPaid<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Student<span style="color: #000000;">&#40;</span>values<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span>=<span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>values<span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> props<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">XMLList</span> = <span style="color: #004993;">describeType</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span>..accessor;
&nbsp;
				<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">each</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> prop<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">XML</span> <span style="color: #0033ff; font-weight: bold;">in</span> props<span style="color: #000000;">&#41;</span>
					<span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#91;</span>prop.@<span style="color: #004993;">name</span><span style="color: #000000;">&#93;</span> = values<span style="color: #000000;">&#91;</span>prop.@<span style="color: #004993;">name</span><span style="color: #000000;">&#93;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>* More information on the <em>describeType</em> function <a href="http://ria-coder.com/blog/acedia/">here</a>.</p>
<p>And the PHP equivalent:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #000000; font-weight: bold;">class</span> Student
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$ID</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$firstName</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$surname</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$age</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$accountPaid</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$properties</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$properties</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$properties</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayObject<span style="color: #009900;">&#40;</span><span style="color: #000088;">$properties</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">get_object_vars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$properties</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$prop</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
					<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$prop</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Now, you can easily pass an object (with no type) to either of these constructors, and they will automatically transform that object into a strongly typed, meaningful and above all else &#8211; easy to work with &#8211; variable.</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/making-your-constructors-more-useful/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating Flex, AMFPHP and CodeIgniter (also including Value-Objects)</title>
		<link>http://ria-coder.com/blog/integrating-flex-amfphp-and-codeigniter-with-value-objects</link>
		<comments>http://ria-coder.com/blog/integrating-flex-amfphp-and-codeigniter-with-value-objects#comments</comments>
		<pubDate>Mon, 05 Jan 2009 15:40:54 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Lessons]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=102</guid>
		<description><![CDATA[Yesterday i recorded a video tutorial on integrating Flex, AMFPHP and CodeIgniter. This tutorial will walk you through each step of the process. If you have any questions, please post them as comments and i'll answer them as best i can.]]></description>
			<content:encoded><![CDATA[<p><script src="swfobject/swfobject.js" type="text/javascript"></script> <script type="text/javascript"><!--
	swfobject.registerObject("myFlashContent", "9.0.0", "expressInstall.swf");
// --></script></p>
<div>Yesterday i recorded a video tutorial on integrating Flex, AMFPHP and CodeIgniter. This tutorial will walk you through each step of the process. If you have any questions, please post them as comments and i&#8217;ll answer them as best i can.<span id="more-102"></span></div>
<div><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="318" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="id" value="myFlashContent" /><param name="src" value="http://ria-coder.com/blog/videos/Blog%20Version.swf" /><embed id="myFlashContent" type="application/x-shockwave-flash" width="400" height="318" src="http://ria-coder.com/blog/videos/Blog%20Version.swf"></embed></object></div>
<div><a title="Full-size Video" href="http://ria-coder.com/blog/videos/Integrating%20Flex,%20AMFPHP%20and%20CodeIgniter.swf" target="_blank">Here</a> is a link to the larger version of the tutorial,</div>
<div><a title="Project Files" href="http://ria-coder.com/blog/videos/remoting-example.7z" target="_blank">here</a> is a link to the project files and</div>
<div><a title="Database" href="http://ria-coder.com/blog/videos/users.sql" target="_blank">here</a> is the database dump</div>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/integrating-flex-amfphp-and-codeigniter-with-value-objects/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Server.Acknowledge.Failed &#8211; another AMFPHP ballache</title>
		<link>http://ria-coder.com/blog/serveracknowledgefailed-another-amfphp-ballache</link>
		<comments>http://ria-coder.com/blog/serveracknowledgefailed-another-amfphp-ballache#comments</comments>
		<pubDate>Mon, 03 Nov 2008 09:12:11 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[errors]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=38</guid>
		<description><![CDATA[While working on a project today, i encountered a serious ballache in the form of this: mx.rpc.Fault (@14f27331) [inherited] faultCode &#8220;Server.Acknowledge.Failed&#8221; faultDetail &#8220;Was expecting message &#8217;93EDDF20-516F-2C3F-AA63-619BAB9DA793&#8242; but received &#8221;.&#8221; faultString &#8220;Didn&#8217;t receive an acknowledgement of message&#8221; rootCause null AMFPHP, for all it&#8217;s wonder and usefulness, doesn&#8217;t document its errors very well. Very irritating. After much]]></description>
			<content:encoded><![CDATA[<p>While working on a project today, i encountered a serious ballache in the form of this:</p>
<p><strong>mx.rpc.Fault (@14f27331)<br />
[inherited]<br />
faultCode    &#8220;Server.Acknowledge.Failed&#8221;<br />
faultDetail    &#8220;Was expecting message &#8217;93EDDF20-516F-2C3F-AA63-619BAB9DA793&#8242; but received &#8221;.&#8221;<br />
faultString    &#8220;Didn&#8217;t receive an acknowledgement of message&#8221;<br />
rootCause    null </strong></p>
<p>AMFPHP, for all it&#8217;s wonder and usefulness, doesn&#8217;t document its errors very well. Very irritating. After much digging, i found that the solution to this isn&#8217;t actually anything to do with the AMFPHP framework, nor with Flex! It&#8217;s stupid little error in PHP&#8230; Make sure that you aren&#8217;t trying to return an array or object in PHP that has an undefined index or property. I slapped my forehead when i realised the error of my ways.</p>
<p>Sigh.</p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/serveracknowledgefailed-another-amfphp-ballache/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Integrating CodeIgniter with AMFPHP</title>
		<link>http://ria-coder.com/blog/integrating-codeigniter-with-amfphp</link>
		<comments>http://ria-coder.com/blog/integrating-codeigniter-with-amfphp#comments</comments>
		<pubDate>Sun, 02 Nov 2008 21:09:02 +0000</pubDate>
		<dc:creator>Danny Kopping</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Lessons]]></category>
		<category><![CDATA[amfphp]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[remoting]]></category>

		<guid isPermaLink="false">http://ria-coder.com/blog/?p=36</guid>
		<description><![CDATA[A while back i spent an evening hacking away at the CodeIgniter source code. I was desperate to use it as a library, as opposed to a framework. I don&#8217;t use PHP with HTML. I did for a little bit, but personally i found that HTML and CSS were the biggest load of shit languages]]></description>
			<content:encoded><![CDATA[<p>A while back i spent an evening hacking away at the CodeIgniter source code. I was desperate to use it as a library, as opposed to a framework. I don&#8217;t use PHP with HTML. I did for a little bit, but personally i found that HTML and CSS <strong>were the biggest load of shit languages ever to plague my existence! </strong>Sorry. Once i was introduced to Flash and Flex, i said <strong>&#8220;to hell with HTML and it&#8217;s ugly sister CSS! I&#8217;m becoming a banner-maker!&#8221;</strong>. Not quite&#8230; i&#8217;ve never made a banner &#8211; even though that&#8217;s like totally the whole point of Flash, dude&#8230; (insert stupid programmer comments here).</p>
<p>Ahem. Back to the point. So when i started writing Flex apps and using AMFPHP for my remoting, i desperately wanted a nice concise, easy-to-use, well documented library. Enter <a href="http://www.codeigniter.com" target="_blank">CodeIgniter</a> by Rick Ellis. Although CI is actually a MVC framework for PHP, i decided i was going to turn it into a library! (and what a ballache that was).</p>
<p>Below is the massive, complex, obfuscated script I wrote to turn it into a library. Notice how the script seems to drip with programming excellence:</p>
<pre><span>&lt;?php
    </span><span>if (!</span><span>defined</span><span>(</span><span>'BASEPATH'</span><span>)) </span><span>define </span><span>(</span><span>"BASEPATH"</span><span>, </span><span>"../CodeIgniter/system/"</span><span>);
    if (!</span><span>defined</span><span>(</span><span>'APPPATH'</span><span>)) </span><span>define </span><span>(</span><span>"APPPATH"</span><span>, </span><span>"../CodeIgniter/system/application/"</span><span>);
    if (!</span><span>defined </span><span>(</span><span>"EXT"</span><span>)) </span><span>define </span><span>(</span><span>"EXT"</span><span>, </span><span>".php"</span><span>);

    require_once (</span><span>BASEPATH</span><span>.</span><span>"codeigniter/Base5.php"</span><span>);
    require_once (</span><span>BASEPATH</span><span>.</span><span>"libraries/Controller.php"</span><span>);
    require_once (</span><span>BASEPATH</span><span>.</span><span>"codeigniter/Common.php"</span><span>);
</span><span>?&gt;</span></pre>
<p>Crazy huh? Haha. Essentially, all this script does is fuck with some of the framework architecture and allow the package to be required in PHP. See the usage below:</p>
<pre>&lt;?php
    require_once("CodeIgniter.php"); // the path to your CodeIgniter.php script as described above</pre>
<pre><span>    </span><span>class </span><span>AMFPHP_CI_Integration
    {
         function __construct() // PHP constructor
         {
                parent::Controller();  // Extend the functionality of the CI Controller class
         }
    }</span></pre>
<p><span></p>
<pre>?&gt;</pre>
<p>And that&#8217;s it! Flimsy and hackerish, i know, but hey&#8230; It works <img src='http://ria-coder.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Any queries or suggestions are most welcome!</p>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://ria-coder.com/blog/integrating-codeigniter-with-amfphp/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>
