I am reading in an XML file in AS3. I need to find out if an attribute exists on a node. I want to do something like:
if(xmlIn.attribute("id")){
foo(xmlIn.attribute("id"); // xmlIn is of type XML
}
This doesn’t work however. The above if statement is always true, even if the attribute id isn’t on the node.
You have to do this instead:
In the XML E4X parsing, you have to use hasOwnProperty to check if a property for the attribute as been set on the E4X XML object node. Hope this helps!