Creating the Server-Side Application
The server-side portion of the video chat/message center application is contained within a single ASC file, main.asc. Here are the steps necessary to create the server-side part of this application:
Create a new FlashCom application named
CommunicationCenterApp
. You can do this by making a new directory with this name inside of the FlashCom server’s applications directory.Create a new file inside of the
CommunicationCenterApp
directory. Name the file main.asc.Add the following code to main.asc:
// The
application.onConnect( )
method is invoked each time a new client connects // to the application. ThenewClient
parameter is a FlashCom-generated reference // to the new client. Theusername
parameter is a value passed to the method by // the Flash client. application.onConnect = function (newClient, username, password) { newClient.username = username; newClient.password = password; // TheacceptClient( )
function accepts the client and assigns methods to the // client object according to the user type. acceptClient(newClient); }; // Theapplication.onDisconnect( )
method is automatically invoked whenever a // client disconnects from the application. application.onDisconnect = function (disconnectClient) { // If the client who has disconnected was on a call with the administrator, // release that connection by setting thecallingClient
property tonull
. Also, // if the administrator is still online, invoke theincomingCallEnd( )
method // in the ...
Get Actionscript Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.