Home
HomeFlexible, Lightweight and Truly Skinnable Flash ComponentsPHPObject and other Flash ExtensionsForumsBlog JournalLinks
Buy Flash Components
  PHPObject - Opensource PHP Flash Remoting

redhand PHPObject Methods


PHPObject.abortExecute()
Parameters
None

Returns
Nothing.

Description
Allows you to "cancel" the current remote task. However, note that it is not really a cancellation - the remote task already sent will still complete its procedures and the server will still eventually send back a return message. If the task was sent to update a database, for example, this would still be done. The abortExecute() method only cause the incoming message, meant for the cancelled task, to be silently discarded (and therefore not affect the local object). The onAbort event is triggered when abortExecute is invoked.

Reminder:
Remember that each PHPObject can only have one active task at any time (to prevent data corruption), so when you abort a task, it is understood that it is the last task sent that is aborted.

Example
// Actionscript
myFoo.onAbort = function()
{
trace("Your request has been aborted!");
}
myFoo.abortExecute();



PHPObject.delayExecute()
Parameters
none

Returns
Nothing.

Description
Method. Stops remote methods from being sent to the server immediately when they are called; instead they will be kept in a queue until the PHPObject.execute() method has been called, then the methods will be sent to the server in a batch.

This method should only be used when you need to execute remote methods sequentially, in those situations where you would not require interim results from the server in-between remote method calls.

The 'onResult' event of the last method on the queue list is executed upon receiving response from the server.

Example
// Actionscript
myFoo.delayExecute();
myFoo.doRemoteMethod1();
myFoo.doRemoteMethod2();
myFoo.execute();


PHPObject.execute()
Parameters
none

Returns
Nothing.

Description
Method. This is called at some point after a delayExecute() method has been called. Calling this method sends out the remote methods kept in the queue to the server. The methods would be processed on the server in the order they were called. It also cancels the delayExecute() function, meaning that unless you call delayExecute() again, subsequent remote methods will be executed as normal - immediately and not kept in the queue.

Example
// Actionscript
myFoo.delayExecute();
myFoo.doRemoteMethod1();
myFoo.doRemoteMethod2();
myFoo.execute();


PHPObject.getOutput()
Parameters
none

Returns
The output buffer from the server task.

Description
If your remote task(s) has an output (eg. from echo, print and other similar functions), the gateway will keep all the output in the buffer and returns this buffer back to Flash. You can retrieve this output by calling the getOutput() method of the object.

Example
// PHP Class
class Foo
{
function printCountry($id)
{
print $country_names[$id];
}
}

// Actionscript
myFoo = new PHPObject("Foo");
myFoo.printCountry_onResult = function()
{
trace(this.getOutput());
}
myFoo.printCountry(1);


PHPObject.setDefaultGatewayKey(key)
Parameters
key String, specifying the token to be passed to the gateway as the key to gain access

Returns
Nothing.

Description
Sets the default gateway key. Subsequent PHPObjects declared after this method is called will assume this key by default. The key must match the one specified in the gateway, otherwise an "Invalid Key" error will occur when trying to access the gateway.

Example
// Actionscript
myFoo.setDefaultGatewayKey("secretkey");


PHPObject.setDefaultGatewayUrl(url)
Parameters
url String, specifying the path, absolute or relative, to the gateway

Returns
Nothing.

Description
Sets the default gateway URL. Subsequent PHPObjects declared after this method is called will assume this URL as their gateway's URL by default.

Example
// Actionscript
myFoo.setDefaultGatewayUrl("https://mydomain.com/services/Gateway.php");


PHPObject.utf8encode(flag)
Parameters
flag Boolean, true or false

Returns
Nothing.

Description
By default the gateway returns results back to Flash utf8 encoded, which is what you will want most of the time. However, when you consume web services, the results from the web services are usually already utf8 encoded. In this case, if we do not switch off the utf8 encoding in the gateway, you will receive messages that are encoded twice, resulting in garbled characters for unicode characters.

Example
// Actionscript
myFoo.utf8encode(false);


>> Documentation <<

 
Contact UsSite Map
Copyright © 2003-2006 GhostWire Studios