
XMLSocket.close() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
956
|
ActionScript Language Reference
See Also
loadVariables(), the LoadVars class, the XML class
XMLSocket.close() Method
terminate an open connection to a server application
Flash 5
socket.close()
// Invoked when a message is received
chatController.onXML = function (src) {
trace("Received XML: " + src);
var message = src.firstChild.firstChild.nodeValue;
chatMain.output_txt.text += message + "\n";
};
// Invoked when a connection attempt fails
chatController.onConnectFailure = function () {
chatMain.output_txt.text += "Connection attempt failed." + "\n";
};
// Invoked when a connection attempt succeeds
chatController.onConnectSuccess = function () {
chatMain.output_txt.text += "Connection established." + "\n";
};
// Invoked when the server drops the connection
chatController.onServerKillConnect = function () {
chatMain.output_txt.text += "Connection terminated by server." + "\n";
};
// Invoked when Flash closes the connection
chatController.onClientKillConnect = function () {
chatMain.output_txt.text += "Connection closed." + "\n";
};
// Add a listener to capture Enter key presses
chatController.onKeyDown = function () {
// If the Enter key is pressed while the cursor is in the send field...
if (Key.getCode() = = Key.ENTER
&& eval(Selection.getFocus()) ...