
58
For example, the following URIs are formatted correctly:
• rtmp://www.myCompany.com/myMainDirectory/groupChatApp/HelpDesk
• rtmp:/sharedWhiteboardApp/June2002
p1 ... pN Optional parameters of any type to be passed to the application specified in
targetURI. If the application is unable to process the parameters in the order in which they are
received, NetConnection.onStatus is invoked with the code property set to
NetConnection.Connect.Rejected.
Returns
A Boolean value of true if you passed in a valid URI, false otherwise. (To determine if the
connection was successfully completed, use
NetConnection.onStatus.).
Description
Method; connects to an application on the Flash Communication Server. This method can also
be used to communicate with an application server. For information, see Using Flash Remoting.
If you want to use this connection for publishing or playing audio or video in real time, or to
publish or play previously recorded audio or video streams, you must connect to the Flash
Communication Server and then create a NetStream object within this NetConnection object.
For more information, see the “NetStream (object)” entry.
If you want to use this connection for synchronizing data among multiple clients or between the
client and a server, you must connect to the Flash Communication Server and then create a
remote shared object within this NetConnection object. For more information, see the
“SharedObject (object)” entry.
When you call this method, the
NetConnection.onStatus event handler is invoked with an
information object that specifies whether the connection succeeded or failed. For more
information, see the example below and
NetConnection.onStatus. If the connection is
successful,
NetConnection.isConnected is set to true.
Because of network and thread timing issues, it is better to place a
NetConnection.onStatus
handler in a script before a
NetConnection.connect method. Otherwise, the connection might
complete before the script executes the onStatus handler initialization. Also, all security checks
are made within the
connect method, and notifications will be lost if the onStatus handler is
not yet set up.
If the specified connection is already open when you call this method, an implicit
NetConnection.close method is invoked, and then the connection is reopened.
During the connection process, any server responses to subsequent
NetConnection.call,
NetStream.send, or SharedObject.send methods are queued until the server authenticates the
connection and
NetConnection.onStatus is invoked. The call or send methods are then
processed in the order received. Any pending updates to remote shared objects are also queued
until the connection is successful, at which point they are transmitted to the server.
Video and audio, however, are not queued during the connection process. Any video or audio
that is streaming from the server is ignored until the connection is successfully completed. For
example, confirm that the connection was successful before enabling a button that calls the
NetStream.publish method.
Comentários a estes Manuais