
Client-Side Communication ActionScript 55
Description
Constructor; creates an object that can be used to connect the Flash Player to the Flash
Communication Server or to an application server. After creating the NetConnection object, use
NetConnection.connect to make the actual connection.
For information on using Flash with an application server, see Using Flash Remoting.
Example
The following doConnect() function uses the NetConnection constructor to create a new
connection and connect to the server.
function doConnect() {
// Make a new connection object
connection = new NetConnection();
// Get the name of the server from user input
// and assign it to a variable named myURL
myURL=serverName;
// Connect to the service
connection.connect("rtmp://" + myURL + "/someApp/someInstance");
}
See also
NetConnection.connect
NetConnection.call
Availability
• Flash Player 6.
• Flash Communication Server MX.
Usage
myConnection.call(remoteMethod, resultObject | null [, p1,...,pN])
Parameters
remoteMethod A parameter in the form [/objectPath/]method; if you are calling a method
on a NetConnection object, you can omit
objectPath. For example, the parameter /someObj/
doSomething
means the server must call the someObj.doSomething method of the application
passed to
NetConnection.connect in its targetURI parameter, passing the specified p1,...,pN
parameters.
For security reasons, certain
remoteMethod names are reserved at the application level; do not use
this event handler to call those methods. The reserved names are
/onConnect, /onDisconnect, /
onStatus
, /onAppStop, and /onAppStart.
resultObject An object parameter that is needed only when the sender is expecting a result.
The result object can be any user-defined object. For it to be of use, a method named
onResult
must be called when the result arrives. If you don’t need a result object, pass
null.
p1,...pN Optional parameters to be passed to the specified method.
Returns
Nothing.
Comentarios a estos manuales