XML.lastChild Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
XML.lastChild Property Flash 5

a reference to the last descendant of a node read-only
theNode.lastChild

Description

The lastChild property is synonymous with childNodes[childNodes.length - 1]. It returns a reference to the last node object that descends from theNode, where theNode can be an XML or XMLnode instance. If theNode has no children, lastChild returns null.

In the following XML source fragment, the lastChild of the MESSAGE node is the CONTENT node:

<MESSAGE><USER>gray</USER><CONTENT>hi</CONTENT></MESSAGE>

Example

// Create a new XML document myDoc = new XML('<MESSAGE><USER>gray</USER><CONTENT>hi</CONTENT></MESSAGE>');     // Sets msg to "hi" because myDoc's firstChild // is MESSAGE; MESSAGE's lastChild is CONTENT; and CONTENT's firstChild // is the text node with the value "hi" msg = myDoc.firstChild.lastChild.firstChild.nodeValue

See Also

XML.childNodes, XML.firstChild, XML.nextSibling, XML.previousSibling



    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