Flash Media Server |
|||
| Developing Media Applications > Using Media Classes > About the Application class > 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:
// On the server side you would have the following
application.onConnect = function(newClient, name)
{
newClient.name = name;
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);
|
TIP |
|
If you're using components, see Handling events in a component-based application. |
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/fms/2/docs/00000052.html
Comments
wardy277 said on Nov 19, 2008 at 9:30 AM :