
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
70
Parameters
name A string; identifies the header and the ActionScript object data associated with it.
mustUnderstand A boolean; true indicates that the server must understand and process this header before it
handles any of the following headers or messages.
object An Object.
Example
The following example creates a new NetConnection instance,
nc, and connects to an application at web server
www.foo.com that is listening at port 1929. This application dispatches the service /blag/SomeCoolService. The last
line of code adds a header called
foo.
nc=new NetConnection();
nc.connect("http://www.foo.com:1929/blag/SomeCoolService");
nc.addHeader("foo", true, new Foo());
NetConnection.call()
nc.call(methodName, [resultObj [, p1, ..., pN])
Invokes a command or method on another 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.
Note: To call a method on a client from a server, use the
Client.call() method.
Availability
Flash Communication Server 1
Parameters
methodName A string indicating a method specified in the form "[objectPath/]method". For example, the
someObj/doSomething command 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 Object. This optional parameter is used to handle return values from the server. The result object
can be any object that 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 Action-
Script object. These parameters are passed to the
methodName parameter 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.
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
Sum() method on server 2:
nc1.connect("rtmp://server2.mydomain.com/App1", "svr2",);
nc1.call("Sum", new Result(), 3, 6);
Commenti su questo manuale