This doesn't work because the player tries to find subNode
in each node
, and it can’t, so a ReferenceError
exception is thrown.
In this case you can use hasOwnProperty
method to ensure that the property exists:
trace(myXml.node.(hasOwnProperty("subNode") && subNode == 123).anotherNode);