MACROMEDIA FLASH MEDIA SERVER 2-SERVER-SIDE ACTIONSCRIPT LANGUAGE Reference page 34

Server-side actionscript language reference
Table of Contents

Advertisement

If you don't use the Flash Media Server components framework, you can execute code in the
application.onConnect
the components framework, however, any code you want to execute after the connection is
accepted or rejected must be placed in the event handlers
and
application.onConnectReject
whether a connection is accepted or rejected.
Example
The following example is the client-side code you can use for an application:
nc = new NetConnection();
nc.connect("rtmp:/test","jlopes");
nc.onStatus = function(info) {
trace(info.code);
};
nc.doSomething = function(){
trace("doSomething called!");
}
The following example is server-side code you can include in the main.asc file:
// 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);
}
34
Server-Side ActionScript Language Reference
handler after accepting or rejecting the connection. When you use
. This architecture allows all the components to decide
application.onConnectAccept

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MEDIA SERVER 2-SERVER-SIDE ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash media server 2

Table of Contents