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 thesuccess
parameter set tofalse
.
Otherwise, it parses the source into
XMLdoc
, setsXMLdoc.loaded
totrue
, and callsXMLdoc.onLoad( )
with thesuccess
parameter 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( )
Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.