User Guide
NetConnection class 105
NetConnection.call()
Availability
Flash Communication Server MX 1.0.
Usage
myNetConnection.call(methodName, [resultObj, p1, ..., pN])
Parameters
methodName A method specified in the form [objectPath/]method. For example, the
command
someObj/doSomething tells the remote server to invoke the
clientObj.someObj.doSomething method, with all the p1, ..., pN parameters. If the
object path is missing,
clientObj.doSomething() is invoked on the remote server.
resultObj An optional parameter that is used to handle return values from the server. The
result object can be any object you defined and can have two defined methods to handle the
returned result:
onResult and onStatus. If an error is returned as the result, onStatus is
invoked; otherwise,
onResult is invoked.
p1, ..., pN Optional parameters that can be of any ActionScript type, including a
reference to another ActionScript object. These parameters are passed to the
methodName
specified above when the method is executed on the remote application server.
Returns
For RTMP connections, returns a Boolean value of true if a call to methodName is sent to the
client; otherwise,
false. For application server connections, it always returns true.
Description
Method; invokes a command or method on a Flash Media Server or an application server to
which the application instance is connected. The
NetConnection.call method on the server
works the same way as the
NetConnection.call method on the client: it invokes a command
on a remote server.
Example
The following example uses RTMP to execute a call from one Flash Media Server to another
Flash Media Server. The code makes a connection to the App1 application on server 2 and
then invokes the method
Sum on server 2:
nc1.connect("rtmp://server2.mydomain.com/App1", "svr2",);
nc1.call("Sum", new Result(), 3, 6);
NOTE
If you want to call a method on a client from a server, use the Client.call() method.