This content has been marked as final. Show 4 replies
As you traverse through the nodes simply add the value to the array.
--> Adobe Community Expert
*Flash Helps* http://www.smithmediafusion.com/blog/?cat=11
*THE online Radio* http://www.tornadostream.com <--check this
*Must Read* http://www.smithmediafusion.com/blog
"gryllsie" <email@example.com> wrote in message
>I need to collect a whole set of XML nodes into an array, so that I can
> randomly select them to populate a particular space on the stage. I'm sure
> a fairly straightforward thing to do, but it's new to me!
You can construct the array exactly like that. But how are you retreiving the nodes in the first place?
I've recently started using the XPathAPI class. It makes finding the nodes much easier - don't know why I didn't use it ages ago. Anyhow the XPathAPI.selectNodeList method returns an array of nodes. You might want to check that out if you want to draw your nodes from different parts of your xml.
Otherwise (I suspect this is not the case for you) if they all have the same parentNode...then its a simple XMLNode.childNodes property which gives you a read-only array of childNodes.
I've tried something like this and when I do a Trace on the array, it comes up undefined. The while statement below is inside the XML loading function
I am using the AS 2.0 Language Reference, I cannot find the XPathAPI class, where can I find info on its operations and constructors!