Reputation: 696
Does anyone know if there is a way to retrieve the index of an XML child element with a specific a attribute in ActionScript?
Say...
foo.child.@attribute //index of
I tried using the method like this:
[email protected]()
but it returns -1
.
Upvotes: 0
Views: 2397
Reputation: 831
Using hasOwnProperty method works for me:
foo.child.(hasOwnProperty("@attribute")).childIndex()
But if element with @attribute
is not unique, then the right code is:
foo.child.(hasOwnProperty("@attribute"))[0].childIndex()
Upvotes: 1