<?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>Caleb Adam Haye &#187; PHP</title>
	<atom:link href="http://caleb.org/blog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://caleb.org/blog</link>
	<description></description>
	<lastBuildDate>Fri, 25 Sep 2009 10:40:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AMFPHP in  AS3</title>
		<link>http://caleb.org/blog/actionscript-3/amfphp-in-as3/</link>
		<comments>http://caleb.org/blog/actionscript-3/amfphp-in-as3/#comments</comments>
		<pubDate>Mon, 11 Sep 2006 19:46:42 +0000</pubDate>
		<dc:creator>Caleb</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash Remoting]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://caleb.org/blog/?p=8</guid>
		<description><![CDATA[Remoting in ActionScript 3 is easy to implement, but there are some important things to keep in mind.  Most notably, the mx.remoting package is no longer required.  There are no additional packages to install, everything you  need is built right in to flash.net
This RemotingConnection class extends NetConnection and sets the objectEncoding to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Remoting">Remoting</a> in ActionScript 3 is easy to implement, but there are some important things to keep in mind.  Most notably, the <i>mx.remoting</i> package is no longer required.  There are no additional packages to install, everything you  need is built right in to <i>flash.net</i></p>
<p>This <i>RemotingConnection</i> class extends NetConnection and sets the objectEncoding to AMF:</p>
<p><code>package<br />
{<br />
	import flash.net.NetConnection;<br />
	import flash.net.ObjectEncoding;<br />
	public class RemotingConnection extends NetConnection<br />
	{<br />
		public function RemotingConnection( sURL:String )<br />
		{<br />
			objectEncoding = ObjectEncoding.AMF0;<br />
			if (sURL) connect( sURL );<br />
		}<br />
	}<br />
}<br />
</code></p>
<p>This class employs the above class, and makes a remote service call:</p>
<p><code><br />
package<br />
{<br />
	import flash.net.Responder;<br />
	public class AS3RemotingTest<br />
	{<br />
		public var dataProvider:Array;<br />
		public var gateway : RemotingConnection;<br />
		public function AS3RemotingTest()<br />
		{<br />
			this.init();<br />
		}<br />
		public function init()<br />
		{<br />
			var gatewayUrl:String = "http://localhost:88/amfphp/gateway.php";<br />
			gateway = new RemotingConnection(gatewayUrl);<br />
			var responder:Responder = new Responder(onResult, onFault);<br />
			var arg:String = 'foo';<br />
			gateway.call( "HelloWorld.say", responder, arg);<br />
		}<br />
		public function onResult( result ) : void<br />
		{<br />
			trace('onResult invoked');<br />
			trace(result);<br />
		}<br />
		public function onFault( fault : String ) : void<br />
		{<br />
			trace('onFault invoked');<br />
			trace( fault );<br />
		}<br />
	}<br />
}</code></p>
<p>(<strong>Note: </strong>The above code assumes that you have AMFPHP installed and running out of a folder named amfphp on your localhost)</p>
]]></content:encoded>
			<wfw:commentRss>http://caleb.org/blog/actionscript-3/amfphp-in-as3/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
