
36
Parameters
name A string that identifies the header and the ActionScript object data associated with it.
mustUnderstand A Boolean value; true indicates that the server must understand and process
this header before it handles any of the following headers or messages.
object Any ActionScript object.
Returns
Nothing.
Description
Method; adds a context header to the AMF packet structure. This header is sent with every future
AMF packet. If you call NetConnection.addHeader using the same name, the new header
replaces the existing header, and the new header persists for the duration of the NetConnection
object. You can remove a header by calling
NetConnection.addHeader with the name of the
header to remove and an undefined 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
Availability
Flash Communication Server MX.
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.
Commentaires sur ces manuels