Macromedia flash media server 2-developing media applications User Manual
About the Application class
45
Using the application.onDisconnect handler
The server calls the
application.onDisconnect
handler when a client disconnects from the
application. You can add code to this handler that notifies all other clients about this event, as
in the following example:
in the following example:
// On the server side you would have the following
application.onConnect = function(newClient, name)
{
application.onConnect = function(newClient, name)
{
newClient.name = name;
return true;
return true;
}
application.onDisconnect = function(client)
{
{
for (var i = 0; i < application.clients.length; i++)
{
{
application.clients[i].call("userDisconnects", client,name);
}
}
// On the client side you would have the following
nc = new NetConnection();
nc.userDisconnects= function (name) {
trace(name + "quits");
}
nc.connect ("rtmp:/app_name", userName);
nc.userDisconnects= function (name) {
trace(name + "quits");
}
nc.connect ("rtmp:/app_name", userName);
TI
P
P
If you’re using components, see
.