Packagecom.ericfeminella.rpc
Classpublic class AMFPHPRemoteGateway
InheritanceAMFPHPRemoteGateway Inheritance flash.net.NetConnection
ImplementsIIResponderProxy, IRemoteService

Provides a generic base class API for creating AMFPHP gateway connections and performing remote method invocation / remote procedure call (RPC) invocation on PHP objects.

Typically, you would sub-class AMFPHPRemoteGateway to provide a specific client side implementation of the remote services in which to invoke.

Sub classes of AMFPHPRemoteGateway should implement mx.rpc.IResponder and pass a reference to addResponder();

 Below is a simple usage example:

 package {

 import com.ericfeminella.rpc.AMFPHPRemoteGateway;
 import mx.rpc.IResponder;

 public class AMFPHPRemoteGatewayExample extends AMFPHPRemoteGateway implements IResponder
 {
	 public function AMFPHPRemoteGatewayExample(gatewayURI:String, classPath:String)
	 {
	   super(gatewayURI);
	   this.addResponder(this);
	   this.remoteServiceClass(classPath);
	 }

	 public function result(data:Object):void
	 {
	   trace(data as String);
	 }

	 public function fault(info:Object):void
	 {
	   trace(info as String);
	 }
   }
 }
 


Protected Properties
 PropertyDefined by
  gatewayURI : String
AMFPHPRemoteGateway
  remoteClass : String
AMFPHPRemoteGateway
  responder : IResponder
AMFPHPRemoteGateway
Public Methods
 MethodDefined by
  
AMFPHPRemoteGateway(gatewayURI:String)
Constructor Instantiates a new instance of AMFPHPRemoteGateway and sets objectEncoding to ActionScript Message Format 3 (AMF3).
AMFPHPRemoteGateway
  
addResponder(responder:IResponder):void
Adds a responder which is invoked upon RPC result and fault callbacks
AMFPHPRemoteGateway
  
disconnect():void
Disconnects Flash Player from the persisted RTMP connection
AMFPHPRemoteGateway
  
faultProxy(info:Object):void
Establishes the IResponder fault which will be used as a proxy upon an Responder FaultEvent
AMFPHPRemoteGateway
  
getGatewayURI():String
returns the gateway URI for the instance of AMFPHPRemoteGateway
AMFPHPRemoteGateway
  
invoke(method:String, ... args):void
Performs rpc method invocation on a remote PHP object
AMFPHPRemoteGateway
  
remoteServiceClass(remoteClass:String):void
Sets the class in which remote method invocation is to be made You must include the fully qualified classpath.
AMFPHPRemoteGateway
  
resultProxy(data:Object):void
Establishes the IResponder result which will be used as a proxy upon an ResultEvent.
AMFPHPRemoteGateway
Property detail
gatewayURIproperty
protected var gatewayURI:String
remoteClassproperty 
protected var remoteClass:String
responderproperty 
protected var responder:IResponder
Constructor detail
AMFPHPRemoteGateway()constructor
public function AMFPHPRemoteGateway(gatewayURI:String)

Constructor Instantiates a new instance of AMFPHPRemoteGateway and sets objectEncoding to ActionScript Message Format 3 (AMF3).

Parameters
gatewayURI:String — gateway.php URI; e.g: "http://localhost/amfphp/gateway.php"
Method detail
addResponder()method
public function addResponder(responder:IResponder):void

Adds the responder which is invoked upon RPC result and fault callbacks

Parameters
responder:IResponder — object that implements IResponder
disconnect()method 
public function disconnect():void

Disconnects the Flash Player from the persisted RTMP connection

faultProxy()method 
public function faultProxy(info:Object):void

Establishes the IResponder fault which will be used as a proxy upon an Responder FaultEvent

Parameters
info:Object — IResponder fault method callback
getGatewayURI()method 
public function getGatewayURI():String

returns the gateway URI for the instance of AMFPHPRemoteGateway

Returns
String — the gateway URI
invoke()method 
public function invoke(method:String, ... args):void

Performs rpc method invocation on a remote PHP object

Parameters
method:String — method to invoke on the remote object
 
... args — parameter of arbitrary lengt
remoteServiceClass()method 
public function remoteServiceClass(remoteClass:String):void

Sets the class in which remote method invocation is to be made You must include the fully qualified classpath.

For example, if a remote class EmailDelegate.php resides in a package data.business, you must set remoteServiceClass to the exact same path:

remoteServiceClass("data.business.EmailDelegate")

The remoteServiceClass can be set at runtime, therefore a single instance of AMFPHPRemoteGateway may call methods on various objects

Parameters
remoteClass:String — remote class to invoke
resultProxy()method 
public function resultProxy(data:Object):void

Establishes the IResponder result which will be used as a proxy upon an ResultEvent.

Parameters
data:Object — IResponder result method callback