I know that most of you know how to do this, however I've never tried, and don't really understand how the book explains it.
I have an XML file filled with strings I need to use in flash.
ex:
Code:
[XML]
[MAIN]
[TEXT]This is one[/TEXT]
[TEXT] This is two[/TEXT]
... continued
[/MAIN]
[/XML]
(with all the "["'s replaced with "<"'s)
Now what I want to do is to dynamically load randomlly load one of these strings into my dynamic text box!
Can someone explain how to randomally get the strings from the xml? mostly how to get them though, I can do the random stuff.
So you get the idea... childNodes is an array like property.. I'm not sure how to describe it... use it like an array by accessing items in it's 'list' with [] operators... and it can be placed after a node, to access that nodes children...
Parent
child1
child2
child3
/Parent
So Parent.childNodes[2] would give you child3.... I hope this is making sense.... Look under childNodes in the Flash help files...
OH - and as always, don't forget to deal with the elusive 'whitespace nodes'.... they will also show up on the childNodes array...
As for your randomness.. just randomise the number inside the brackets, make sure that it isn't over the parent.childNodes.length property of your array....
Yeah.. you've got the idea - you'll want to mess around with the number of childNodes tags you'll need to access certain levels of code.. due to whitespace...