MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Specifiche Pagina 118

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 369
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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;
}
Vedere la pagina 117
1 2 ... 113 114 115 116 117 118 119 120 121 122 123 ... 368 369

Commenti su questo manuale

Nessun commento