Hi list,
I have an XML object (listed below)
I can access a node like, for instance:
trace(myXml.MAMMAL.*) //traces: humancowdog
Now I want to access nodes dynamically through a function like:
function traceNode (thisNode:String):void {
trace(myXml[thisNode].*;
}
traceNode(MAMMALS) works fine because it's a first generation child
of myXml
but traceNode(MAMMAL) returns empty (because MAMMAL is of a younger
generation?)
Eventually I want to be able to access even the whale dynamically by
passing it's 'path' through an argument of my function.
How would I do that?
Thanks,
Willem van den Goorbergh
xml follows:
var myXml:XML =
<ANIMALS>
<MAMMALS>
<MAMMAL>human</MAMMAL>
<MAMMAL>cow</MAMMAL>
<MAMMAL>dog</MAMMAL>
</MAMMALS>
<BIRDS>
<BIRD>blackbird</BIRD>
<BIRD>dove</BIRD>
</BIRDS>
<FISHES>
<FISH>fishAndChips</FISH>
<FISH>goldfish</FISH>
<FISH>herring</FISH>
<FISH>shark</FISH>
<MAMMAL>whale</MAMMAL>
</FISHES>
</ANIMALS>
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone: (+31)
30-2719512 or cell phone: (+31)6-26372378
or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: http://www.geografiek.nl
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com