
22
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
// When using components, always load components.asc.
load("components.asc");
application.onConnect = function(client, username){
trace("onConnect called");
gFrameworkFC.getClientGlobals(client).username = username;
if (username == "hacker") {
application.rejectConnection(client);
}
else {
application.acceptConnection(client);
}
}
// Code is in onConnectAccept and onConnectReject statements
// because components are used.
application.onConnectAccept = function(client, username){
trace("Connection accepted for "+username);
client.call("doSomething",null);
}
application.onConnectReject = function(client, username){
trace("Connection rejected for "+username);
}
application.onConnectReject()
application.onConnectReject = function (clientObj [,p1, ..., pN]){}
Invoked when a connection is rejected in an application that contains components.
Note: This component set is deprecated and not included with Flash Media Server versions 4.0 and later. The components
are available from
www.adobe.com/go/ams_tools.
If you don’t use the version 2 components framework, you can execute code in the application.onConnect()
handler after accepting or rejecting a connection. When you use the components framework, however, any code that
you want to execute after the connection is accepted or rejected must be placed in the
application.onConnectAccept() and application.onConnectReject() framework event handlers. This
architecture allows all of the components to decide whether a connection is accepted or rejected.
Availability
Flash Media Server (with version 2 components only)
Parameters
clientObj A Client object; the client connecting to the application.
p1, ..., pN Optional parameters passed to the application.onConnectReject() handler. These parameters are
passed from the client-side
NetConnection.connect() method when a client connects to the application.
Example
The following example is client-side code that you can use for an application:
Kommentare zu diesen Handbüchern