
XML.onLoad() Event Handler
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
939
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");
The following example intercepts and displays raw loaded XML source, but it also
performs onData()’s normal duties:
myDoc = new XML();
myDoc.onData = function (src) {
trace("Here's the source: \n" + src);
if (src = = undefined) {
this.onLoad(false);
} else {
this.parseXML(src);
this.loaded = true;
this.onLoad(true);
}
};
myDoc.onLoad = function (success) {
trace("Here's the parsed XML: " + this);
trace("Load succeeded? " + success);
};
myDoc.load("book.xml");
See Also
XML.onLoad(), XML.load()
XML.onLoad() Event Handler
executed when external XML data has been loaded and parsed
Flash 5
xmlDoc.onLoad(success)
Arguments
success A Boolean value indicating whether loading was successful (true) or unsuc-
cessful (
false).
Description
The onLoad() handler of xmlDoc executes automatically whenever an external XML file is
loaded into
xmlDoc via the load() or sendAndLoad() methods. The specified xmlDoc must be
the top-level node in an XML object hierarchy (i.e., an instance of the XML class, not the
XMLnode ...