
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:
// 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);
TI
P
If you’re using components, see
“Handling events in a component-based application”
on page 46
.
Содержание FLASH MEDIA SERVER 2-DEVELOPING MEDIA
Страница 1: ...Developing Media Applications ...
Страница 6: ...6 ...
Страница 10: ...10 About This Manual ...
Страница 36: ...36 Flash Media Server Architecture ...
Страница 80: ...80 Debugging and Monitoring Applications ...
Страница 106: ...106 Application Development Tips and Tricks ...
Страница 114: ...114 ...