
XMLSocket.onXML() Event Handler
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
960
|
ActionScript Language Reference
Arguments
src A string containing loaded data, which is usually XML source code.
Description
The onData() event handler executes whenever a zero byte (ASCII null character) is trans-
mitted to Flash over
socket. By default, onData() simply constructs a new XML object
hierarchy from
src and passes that hierarchy to socket.onXML(). However, the onData()
handler can be assigned a custom callback function to intercept
src before ActionScript has
a chance to parse it as XML. Under certain circumstances (such as realtime video games),
manipulating the raw data in
src manually may offer improved performance over Action-
Script’s built-in XML parsing.
Example
The following code shows how to assign a custom callback function to onData(). The call-
back function simply displays any data received by
mySocket and prevents ActionScript
from parsing the data as XML:
mySocket = new XMLSocket();
mySocket.onData = function (src) {
trace("Received data: \n" + src);
};
See Also
XMLSocket.onXML()
XMLSocket.onXML() Event Handler
invoked when data is received by an XMLSocket object and has been parsed as XML
Flash 5
socket.onXML(xmlObject)
Arguments
xmlObject The XML object that will house the incoming XML-formatted data.
Description
The onXML() event handler ...