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:

  1. 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.

  2. Create a new file inside of the CommunicationCenterApp directory. Name the file main.asc.

  3. Add the following code to main.asc:

    // The application.onConnect(  ) method is invoked each time a new client connects
    // to the application. The newClient parameter is a FlashCom-generated reference
    // to the new client. The username parameter is a value passed to the method by
    // the Flash client.
    application.onConnect = function (newClient, username, password) {
    
      newClient.username = username;
      newClient.password = password;
    
      // The acceptClient(  ) function accepts the client and assigns methods to the
      // client object according to the user type.
      acceptClient(newClient);
    };
    
    // The application.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 the callingClient property to null. Also,
      // if the administrator is still online, invoke the incomingCallEnd(  ) 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.