XMLRPC for Actionscript 3.0 - Free Library


By daniel - Posted on 03 August 2007

I just finished porting Matt Shaw's XML-RPC for Actionscript 2.0 code to AS3. This is a really easy way to get Flash to transfer data with an XML-RPC endpoint. Matt did a great job and the conversion wasn't too difficult.

Here's some sample code to show you how to use it.

import flash.events.Event;
import flash.events.ErrorEvent;
 
import com.mattism.http.xmlrpc.*;
import com.mattism.http.xmlrpc.util.*;
 
function rpcCompleteHandler(evt:Event):void
{
	var response:Object = rpc.getResponse();
}
 
function rpcErrorHandler(evt:ErrorEvent):void
{
	var fault:MethodFault = rpc.getFault();
}
 
var rpc:Connection = new ConnectionImpl('http://localhost/xmlrpc.php');
rpc.addEventListener(Event.COMPLETE, rpcCompleteHandler);
rpc.addEventListener(ErrorEvent.ERROR, rpcErrorHandler);
 
rpc.addParam(4, XMLRPCDataTypes.INT);
rpc.call('mypackage.myfunction');

Download XMLRPC for AS3

And without further ado, here are the source files:

Some notes:

If you have any questions or problems leave a comment here. Enjoy!