
98
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
newNC = new NetConnection();
NetConnection.addHeader()
nc.addHeader(name, mustUnderstand, object)
Adds a context header to the Action Message Format (AMF) packet structure. This header is sent with every future
AMF packet. If you call
addHeader() by using the same name, the new header replaces the existing header, and the
new header persists for the duration of the NetConnection object. To remove a header, call
addHeader() and pass it
the name of the header to remove and an undefined object.
Availability
Flash Communication Server 1
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 Adobe 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.
Komentarze do niniejszej Instrukcji