User Guide
NetConnection class 109
■ If the Application.allowDebug property is true, the connection is approved.
To provide total security against debug connections, set
application.allowDebug to
false in the application.xml file. This setting overrides debug connections that are
approved in server-side code.
■ If the connection is approved, Services.onDebugConnect is invoked.
If you can use the
onConnect handler to reject the connection.
Escaping the connection URI
It is important to convert (or escape) special characters in any URI used to connect to Flash
Media Server to URL-encoding. If you do not escape special characters, shared objects cannot
function correctly over an Internet connection. Escaping URIs is especially important when
creating a debugging connection because there are special characters in the debugging
property that must be appended to the URI. Use the following code to escape a URI:
function escapeURI(uri){
index = uri.indexOf('?');
if (index == -1){
return uri;
}
prefix = uri.substring(0, index);
uri = uri.substring(index);
return prefix += escape(uri);
}
basicString = "rtmp://serverName/appName/
instance?_fcsdebug_req=someNumber";
escapedString = escapeURI(BasicString);
nc.connect(EscapedString);
Example
The following example creates an RTMP connection to a Flash Media Server for the myConn
instance of NetConnection:
myConn = new NetConnection();
myConn.connect("rtmp://tc.foo.com/myApp/myConn");
The following example creates an AMF connection to an application server for the myConn
instance of NetConnection:
myConn = new NetConnection();
myConn.connect("http://www.xyz.com/myApp/");