I have some XML nodes in AS3 which I can successfully reference using:
serverXML.wednesday.morning.title
I hace a variable called dayOfWeek that has the value “wednesday” but of course this doesn’t work:
serverXML.dayOfWeek.morning.title
How can I use variables to reference XML nodes?
If you are using E4X notation to reference XML in AS3, you can do this to get the first match:
would return the title node, assuming:
if there’s a chance that there is no node with the attribute match, assign it to an XMLList first to prevent errors:
check that it has length, then reference.