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});
}
}
}


