This page is no longer updated - please visit http://ghostwire.com Thank you!
 

« PHPObject »
An Opensource Alternative to Flash Remoting
Current Release
Readme
Notes
Journal
Archives

Notes
Wednesday May 07, 2003

Syntax difference

If you are already using flash remoting, you may like to note that the syntax in PHPObject is different. Consider the following:

In flash remoting, a typical client-server communication may look like this:

// set up responder
doRemoteMethod_result = function(result) {
    trace(result);
}

// connection
NetServices.setDefaultGatewayURL("/services/gateway.php");
conn = NetServices.createGatewayConnection();
svc = conn.getService("Foo", this);

// invoke method
svc.doRemoteMethod();

In PHPObject, the following syntax applies:
// create a PHPObject
svc = new PHPObject("Foo","/services/gateway.php");

// set up responder
svc.doRemoteMethod_onResult = function(result) {
    trace(result);
}

// invoke method
svc.doRemoteMethod();

When a local object in Flash is declared as a PHPObject, it makes a connection to the server, transparently, to retrieve the default properties of the remote object. This allows you to synchronize data between local and remote. If you don't like this, simply pass a third parameter to switch it off when creating the object.

Which do you prefer? ; )

Posted by sunny at May 7, 2003 11:03 AM

 

Comments

 


Zones



Forums