766 Chapter 12: ActionScript Dictionary
XML.onData
Availability
Flash Player 5
Usage
my_xml.onData = function(src) {
// your statements here
}
Parameters
src
The raw data, usually in XML format, that is sent by the server.
Returns
Nothing.
Description
Event handler; invoked when XML text has been completely downloaded from the server, or
when an error occurs downloading XML text from a server. This handler is invoked before the
XML is parsed and therefore can be used to call a custom parsing routine instead of using the
Flash XML parser. The
XML.onData method returns either the value undefined, or a string that
contains XML text downloaded from the server. If the returned value is
undefined, an error
occurred while downloading the XML from the server.
By default, the
XML.onData method invokes XML.onLoad(). You can override the XML.onData
method with your own behavior, but
XML.onLoad() will no longer be called unless you call it in
your implementation of
XML.onData.
Example
The following example shows what the onData method looks like by default:
XML.prototype.onData = function (src) {
if (src == undefined) {
this.onLoad(false);
} else {
this.parseXML(src);
this.loaded = true;
this.onLoad(true);
}
}
The XML.onData method can be overridden to intercept the XML text without parsing it.