Bit confused about XML in ActionScript here:
I have an XML variable declared as:
public static var thisXML:XML;
and I am initialising my XML with a function that contains the following:
thisXML.white.john = false;
thisXML.black.john = false;
thisXML.white.bill = false;
thisXML.black.bill = false;
thisXML.white.pete = false;
thisXML.black.pete = false;
I then have the following String variables:
public static var blackWhite:String;
public static var thisName:String;
I want to access my XML in an 'if' statement something like this (I know this is not right):
if (!thisXML.(blackWhite).(thisName)) {
//do something
thisXML.(blackWhite).(thisName) = true;
}
So, I have tried many methods including:
thisXML.[blackWhite].[thisName];
thisXML.node[blackWhite].node[thisName];
thisXML.descendant[blackWhite].descendant[thisName];
... but I know this is not right. I also realise that XML does not support Boolean so I may need to use strings "true" and "false", but that is not my issue here. The issue is accessing the specific nodes using variables.
How should this be done?
Thanks for reading.
Edit: - My XML now looks like this....
<root>
<Documents documentName = {thisDocument}>
<White>
<John>false</John>
<Pete>false</Pete>
<James>false</James>
</White>
<Black>
<John>false</John>
<Pete>false</Pete>
<James>false</James>
</Black>
</Documents>
</root>