MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Manuale Utente Pagina 23

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 80
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 22
Server-Side Communication ActionScript 23
When you use components, the last line (in order of execution) of the onConnect method should
be either
application.acceptConnection or application.rejectConnection. Any logic
that follows the explicit acceptConnection or rejectConnection statement needs to go into
application.onConnectAccept and application.onConnectReject statements.
Example
The first example is the client-side code you would use for an application:
nc = new NetConnection();
//try either username
nc.connect("rtmp:/test","jlopes");
//nc.connect("rtmp:/test","hacker");
nc.onStatus = function(info) {trace(info.code);}
nc.doSomething = function(){
trace("doSomething called!");
}
The second example is the server-side code you would include in your 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);
}
}
application.onConnectAccept = function(client, username){
trace("Connection accepted for "+username);
client.call("doSomething",null);
}
application.onConnectReject = function(client, username){
trace("Connection rejected for "+username);
}
See also
Application.acceptConnection, Application.onConnect,
Application.onConnectAccept, Application.rejectConnection
Application.onDisconnect
Availability
Flash Communication Server MX.
Usage
application.onDisconnect = function (clientObj){
// insert code here
};
Vedere la pagina 22
1 2 ... 18 19 20 21 22 23 24 25 26 27 28 ... 79 80

Commenti su questo manuale

Nessun commento