XMLSocket.onData( ) Event Handler | Flash 5 |
executed when external data is received but has not yet been parsed as XML |
A string containing loaded data, which is usually XML source code.
The onData( ) event handler executes whenever a zero byte (ASCII null character) is transmitted 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 ActionScript's built-in XML parsing.
The following code shows how to assign a custom callback function to onData( ). The callback 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); };