An XML object can be traversed by giving each node an 'id' attribute, for example <menuitem id="about"></menuitem>.
Undocumented, but it works. See attached examples below.
Trace output:
this.items = <items id="items"><item id="ABC"><img url="imageA.jpg" /><img url="imageB.jpg" /><img url="imageC.jpg" /></item><item id="DEF"><img url="imageD.jpg" /><img url="imageE.jpg" /><img url="imageF.jpg" /></item><item id="GHI" /><item id="JKL" /></items> ABC = <item id="ABC"><img url="imageA.jpg" /><img url="imageB.jpg" /><img url="imageC.jpg" /></item> ABC children = <img url="imageA.jpg" />,<img url="imageB.jpg" />,<img url="imageC.jpg" /> ABC first image = <img url="imageA.jpg" />
Problems
ids cannot be numbers.This also works in AS2, however since "eval" is no longer available, I don't know of a way to iterate through a series of items. So this seems mainly handy when the ids are known in advance.
Topic contributors:
-- ArthurClemens - 15 Jan 2004
-- StephanBezoen - 15 Jan 2004
Attachment: ![]() | Action: | Size: | Date: | Who: | Comment: |
|---|---|---|---|---|---|
| | action | 14848 | 15 Jan 2004 - 13:12 | ArthurClemens | |
| | action | 331 | 15 Jan 2004 - 13:13 | ArthurClemens | |
| | action | 368 | 15 Jan 2004 - 13:13 | ArthurClemens | |
| | action | 570 | 15 Jan 2004 - 13:13 | ArthurClemens |


