User Guide

1348 ActionScript classes
The default implementation of this method performs no actions. To override the default
implementation, you must assign a function containing actions that you define.
Availability: ActionScript 1.0; Flash Player 5
Parameters
src:XML - An XML object that contains a parsed XML document received from a server.
Example
The following function overrides the default implementation of the
onXML method in a
simple chat application. The function
myOnXML instructs the chat application to recognize a
single XML element,
MESSAGE, in the following format.
<MESSAGE USER="John" TEXT="Hello, my name is John!" />.
The following function displayMessage() is assumed to be a user-defined function that
displays the message received by the user:
var socket:XMLSocket = new XMLSocket();
socket.onXML = function (doc) {
var e = doc.firstChild;
if (e != null && e.nodeName == "MESSAGE") {
displayMessage(e.attributes.user, e.attributes.text);
}
}
See also
function statement
send (XMLSocket.send method)
public send(data:Object) : Void
Converts the XML object or data specified in the object parameter to a string and transmits
it to the server, followed by a zero (0) byte. If
object is an XML object, the string is the XML
textual representation of the XML object. The send operation is asynchronous; it returns
immediately, but the data may be transmitted at a later time. The
XMLSocket.send()
method does not return a value indicating whether the data was successfully transmitted.
If the
myXMLSocket object is not connected to the server (using XMLSocket.connect()), the
XMLSocket.send() operation will fail.
Availability: ActionScript 1.0; Flash Player 5