SSR: Super Simple Remoting

To go along with RubyAMF. I am releasing this pretty cool remoting package for AS3 I wrote over the last couple days. Remoting is as you guessed it – Super Simple with this package. It uses callbacks for each service call’s onResult and onFault. It allows for timeout’s and maxAttempts to be specified as well.

Example:

package
{

	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import org.rubyamf.remoting.ssr.RemotingService;
	import org.rubyamf.remoting.ssr.ResultEvent;
	import org.rubyamf.remoting.ssr.FaultEvent;

	class MyServiceTest extends Sprite
	{

		private var service:RemotingService;

		private function MyServiceTest()
		{
			service = new RemotingService('http://localhost:8024/gateway.rb','test.Test', [0/3]);
			service.addEventListener(FaultEvent.CONNECTION_ERROR, onConnectionError);
			myButton.addEventListener(MouseEvent.CLICK, testService);
		}

		function onConnectionError(fe:FaultEvent):void
		{
			trace("Connection Error: " + fe.fault);
		}

		function onResult(re:ResultEvent):void
		{
			trace(re.result);
		}

		function onFault(fe:FaultEvent):void
		{
			trace(fe.fault.faultString);
		}

		function testService(e:Event):void
		{
			//perform the service call
			service.helloWorld(['Hello World!'], onResult, onFault, {timeout:3000, maxAttempts:2});
		}
	}
}

Download SSR | SSR on OSFlash

Can I send ByteArray ? I have some errors said,

June 10, 2007 @ 04:33

Can I send ByteArray ? I have some errors

aaron said,

June 10, 2007 @ 20:57

Are you using RubyAMF or AMFPHP? It should work fine. Just remember that the first parameter must be wrapped in an array.

RSS feed for comments on this post · TrackBack URI

Leave a Comment