XML.load( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
XML.load( ) Method Flash 5; security restrictions added in Flash 6

import XML source code from an external document
xmlDoc.load(url)

Arguments

url

A string specifying the location of the XML document to load.

Description

The load( ) method imports an external XML document, parses it, converts it into an XML object hierarchy, and places that hierarchy into xmlDoc. Any previous contents of xmlDoc are replaced by the newly loaded XML content. 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 class).

Before accessing content imported with load( ), we must be sure the load and parsing operations are complete. To do so, either check the value of the XML document's loaded property, or assign the document an onLoad( ) callback handler to respond to the load completion. See the XML.loaded and XML.onLoad( ) entries for details. To determine whether the loaded data was parsed successfully, check the document's status property. To monitor the progress of the file transfer, use getBytesLoaded( ) and getBytesTotal( ).

As of Flash 6, XML.load( ) is subject to the domain-based security restrictions described under System.security.allowDomain( ).

Example

myDoc = new XML(); myDoc.load("myData.xml");

See Also

XML.loaded, XML.onLoad( ), XML.sendAndLoad( ), XML.status



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net