
18
Server-Side ActionScript Language Reference
Description
Method; accepts the connection call from a client to the server. The
application.onConnect
event handler is invoked on the server side to notify a script when
NetConnection.connect()
is called from the client side. You can use the
application.acceptConnection()
method in an
application.onConnect
event handler
to accept a connection from a client. You can use the
application.acceptConnection()
method outside an
application.onConnect
event handler to accept a client connection that
had been placed in a pending state (for example, to verify a user name and password).
When you use components and your code includes an explicit call to
application.acceptConnection()
or
application.rejectConnection()
, the last line
(in order of execution) of the
onConnect
event handler should be either
application.acceptConnection()
or
application.rejectConnection()
. Also, any
logic that follows the explicit
acceptConnection
or
rejectConnection
statement must be
placed in
application.onConnectAccept
and
application.onConnectReject
statements, or it will be ignored. This requirement exists only when you use components.
Example
The following example uses the
application.acceptConnection()
method to accept the
connection from
client1
:
application.onConnect = function (client1){
// Insert code here.
application.acceptConnection(client1);
client1.call("welcome");
};
See also
Application.onConnect
,
Application.rejectConnection()
Application.allowDebug
Availability
Flash Media Server 2.
Usage
application.allowDebug
NO
T
E
This example shows code from an application that does not use components.