MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Spécifications Page 118

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 369
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 117
Chapter 3 40
4 Create the event handler for the Connect button. If the user selected the button when the label
was Connect, then connect to the server. If the button label is Disconnect, close the
connection.
// Event handler for Connect_Btn
function doConnect() {
// If user wants to connect...
if (Connect_btn.getLabel() == "Connect") {
// Connect to the chat application
client_nc.connect("rtmp:/doc_hello/room_01", User.text);
// Update button label
Connect_btn.setLabel("Disconnect");
// If user wants to disconnect...
} else if (Connect_btn.getLabel() == "Disconnect") {
// Close connection
client_nc.close();
// Reset button label
Connect_btn.setLabel("Connect");
// Reset the text fields
user.text = "";
message.text = "";
}
}
5
Write the function the server will call to return the message to the client.
// Callback function server calls to send message back to
// this client.
client_nc.msgFromSrvr = function(msg) {
var msg;
_root.Message.text = msg;
}
Vue de la page 117
1 2 ... 113 114 115 116 117 118 119 120 121 122 123 ... 368 369

Commentaires sur ces manuels

Pas de commentaire