Hey all,
I am about to release on our blog our DrupalProxy flash/flex as3 class under the MIT license provided by our company's open source package that enables you to talk with your drupal backend via the amf services via a flash or flex client.
It is the replacement of our highly successful DrupalService implementation (which you can read about here: http://www.dpdk.nl/opensource/drupalservice-as-a-bridge-between-flash-an...)
The class is much simpler, implemented for drupal 6, but we'll be updating when drupals 7 is released to have it work for both systems, has a very strong and clear API, uses the key and/or session security mechanisms, easy to use and can be used to connect to any service on your drupal system, also custom ones, out of the box. In essence, there is no need to subclass it which makes it very easy to use for any as3 developer. If you would like to subclass it we provide some protected hook methods that can be implemented so you will be able to alter/save state etc according to your needs.
We've been using this package as a replacement of our previous code for some time, it's tested, production tested and it's very stable. In my opinion it's about as good as it can get for any as3 code that wants to connect to your drupal backend.
I'm writing this to get some advice how to best bring it to attention in the drupal community besides writing a post about it here and on our blog. If you could give me some advice on how to do this it would be highly appreciated. We're just so enthusiastic about this code that we want you all to use this.
In the meantime, the new package can be checked out via svn via www.dpdk.nl/opensource so you can see for yourself we're not blabbering.
here's some example code to show you how simple it is:
public function DrupalProxyTest()
{
service = new DrupalProxy("path/to/your/services", true);// "36080b1d746d5a2039614d73b6f5e260", "development.dpdk.nl");
//register the handler for generic/low level errors
service.setErrorHandler(errorHandler);
//we want our calls to return data within 500 milliseconds
service.setTimeOut(500, timeOutHandler);
//add the handling methods for results or errors that come back for a specific method call on a service.
service.addHandler("system", "connect", onSysConnect, onSysConnectError);
service.addHandler("node", "get", onNodeGet, onNodeGetStatus);
service.addHandler("user", "get", onUserGet, onUserGetStatus);
service.addHandler("user", "login", onUserLogin, onUserLoginStatus);
service.invoke("system", "connect");
}
//elsewhere in our class
private function onSysConnect(data:DrupalData):void
{
trace("DrupalProxyTest.onSysConnect(data)" + data.getData());
trace(service.getSessionId());
trace(service.getUser().user.userid);
service.setRemoteCallId("user login rolf");
//service.invoke("user", "login", "rolf", "rolf");
service.setRemoteCallId("node4Four");
service.invoke("node", "get", 4, new Array("nid", "title"));
service.setRemoteCallId("node5Five");
service.invoke("node", "get", 5);
service.setRemoteCallId("menuGetId");
service.invoke("menu", "get", DrupalUtils.MENU_PRIMARY);
service.setRemoteCallId("nonexistent thing called");
service.invoke("service", "nonexistent", 1234, 5678);
service.setRemoteCallId("get the user 1 ONE");
service.invoke("user", "get", 1);
service.setRemoteCallId("get the user 2 TWO");
service.invoke("user", "get", 2);
service.setRemoteCallId("ubercart getcart call");
service.invoke("ubercart", "getCart");
service.setRemoteCallId("crazy call");
service.invoke("nonexistent", "methodWithLoadsOfParamsCHeckOutHTTPSniffer", 1, "two", false, new Array("1", "2"), Math.random());
}
public function errorHandler(data:DrupalData):void
{
trace("DrupalProxyTest.onUserLoginStatus(data)id : " + data.getRemoteCallId() + ": " + data.getMessage());
}
public function timeOutHandler(data:DrupalData):void
{
trace("DrupalProxyTest.onUserLoginStatus(data)id : " + data.getRemoteCallId() + ": " + data.getMessage());
}
private function onNodeGet(data:DrupalData):void
{
switch(data.getRemoteCallId())
{
case "node4Four":
break;
case "node5Five":
break;
}
trace("DrupalTest.onNodeGet(data) callId: " + data.getRemoteCallId() + ": nid" + data.getData().nid + ", " + data.getData().title);
}

Comments
released
Hi,
sorry for the bad autoformatting of code in the previous post..
in the meantime, the blogpost explaining more about it is up and running right here: http://www.dpdk.nl/opensource/drupalproxy-as-a-bridge-between-flash-as3-...
Kind regards,
Rolf Vreijdenberger
drupal and flash: http://www.dpdk.nl/opensource/drupalproxy-as-a-bridge-between-flash-as3-...