Server-Side Communication ActionScript > Application.registerProxy |
![]() ![]() ![]() |
Application.registerProxy
Availability
Flash Communication Server MX.
Usage
application.registerProxy(methodName
,proxyConnection
[,proxyMethodName
])
Parameters
methodName
The name of a method. All requests to execute methodName
for this application instance are forwarded to the proxyConnection
object.
proxyConnection
A Client or NetConnection object. All requests to execute the remote method specified by methodName
are sent to the Client or NetConnection object that is specified in the proxyConnection
parameter. Any result that is returned is sent back to the originator of the call. To unregister, or remove, the proxy, provide a value of null
for this parameter.
proxyMethodName
An optional parameter. The server calls this method on the object specified by the proxyConnection
parameter if proxyMethodName
is different from the method specified by the methodName
parameter.
Returns
A value that is sent back to the client that made the call.
Description
Method; maps a method call to another function. You can use this method to communicate between different application instances that can be on the same Flash Communication Server (or different Flash Communication Servers). Clients can execute server-side methods of any application instances to which they are connected. Server-side scripts can use this method to register methods to be proxied to other application instances on the same server or a different server. You can remove or unregister the proxy by calling this method and passing null
for the proxyConnection
parameter, which results in the same behavior as never registering the method at all.
Example
In the following example, the application.registerProxy
method is called in a function in the application.onAppStart
event handler and executes when the application starts. Inside the function block, a new NetConnection object called myProxy
is created and connected. The application.registerProxy
method is then called to assign the method getXyz
to the myProxy
object.
application.onAppStart = function(){ var myProxy = new NetConnection();myProxy.connect("rtmp://xyz.com/myApp"); application.registerProxy("getXyz", myProxy); };
![]() ![]() ![]() |