Using The Application.ondisconnect Handler - MACROMEDIA FLASH MEDIA SERVER 2-DEVELOPING MEDIA Develop Manual

Developing media applications
Table of Contents

Advertisement

Using the application.onDisconnect handler

The server calls the
application.onDisconnect
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);
If you're using components, see
on page
46.
handler when a client disconnects from the
"Handling events in a component-based application"
About the Application class
45

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Flash media server 2

Table of Contents