XML.previousSibling Property

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

a reference to the node before this node read-only
theNode.previousSibling

Description

The previousSibling property returns a reference to the node object preceding theNode in the current level of the XML object hierarchy (theNode can be an XML or XMLnode instance). If there is no node before theNode in the current level of the hierarchy, it returns null.

In the following XML source fragment, the previousSibling of the CONTENT node is the USER node:

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

Example

The previousSibling property can be used to traverse an XML object hierarchy, although nextSibling is more commonly used for this purpose. To view all the children of theNode in reverse order, we can use:

for (var i = theNode.lastChild; i != null; i = i.previousSibling) {   trace("found node: " + i.nodeName); }

See Also

XML.childNodes, XML.firstChild, XML.lastChild, XML.nextSibling, XML.nodeName, XML.nodeValue, XML.parentNode

     
       About Safari   |   Terms of Service   |   Privacy Policy   |   Contact Us   |   Help   |   Submit a Problem
    Copyright 2002 O'Reilly & Associates, Inc. All rights reserved.
    1005 Gravenstein Highway North
    Sebastopol, CA 95472
     


    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