How can you tell if an XMLlist object in AS3 contains a specific node? For ex: you have this XML file
<items>
<item>one</items>
</items>
And want to check if in this file exists a child with tag <pp>
?
How can you tell if an XMLlist object in AS3 contains a specific node? For ex: you have this XML file
<items>
<item>one</items>
</items>
And want to check if in this file exists a child with tag <pp>
?
used this simple code which worked:
if ("pp" in XMLlist) {
trace("exist");
}
var xml:XML = <items> <item>one</items> </items>;
// my favorite method (works also for testing attributes)
if (xml.pp.length()) {
// xml contains one or more <pp> child elements
}
else {
// xml contains no <pp> child elements
}