O'Reilly logo

Actionscript Cookbook by Joey Lott

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required