MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Dokumentacja Strona 118

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 369
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 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;
}
Przeglądanie stron 117
1 2 ... 113 114 115 116 117 118 119 120 121 122 123 ... 368 369

Komentarze do niniejszej Instrukcji

Brak uwag