Name
XML.onData( ) Event Handler — executed when external XML source code finishesloading, but has not yet been parsed
Availability
Flash 5 (undocumented)
Synopsis
XMLdoc.onData(src);
Arguments
- src
A string containing the loaded XML source code.
Description
The onData( ) handler executes automatically
whenever raw XML source has finished loading into
XMLdoc due to an earlier load(
) or sendAndLoad( ) invocation. By
default, onData( ) has the following behavior:
If the raw source received is
undefined, it callsXMLdoc.onLoad( )with thesuccessparameter set tofalse.
Otherwise, it parses the source into
XMLdoc, setsXMLdoc.loadedtotrue, and callsXMLdoc.onLoad( )with thesuccessparameter set totrue.
The onData( ) handler may be assigned a custom
callback function to intercept raw XML source code before
ActionScript has a chance to parse it. Under certain circumstances,
manipulating raw XML source manually may offer improved performance
over ActionScript’s built-in parsing.
Example
The following example shows how to display raw loaded XML source while preventing it from being parsed by ActionScript:
myDoc = new XML();
myDoc.onData = function (src) {
trace("Here's the source: \n" + src);
};
myDoc.load("book.xml");See Also
XML.onLoad( )
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access