如何在AS3中检索具有特定属性的XML元素的索引?

如何在AS3中检索具有特定属性的XML元素的索引?,xml,indexing,actionscript,Xml,Indexing,Actionscript,有人知道是否有方法检索ActionScript中具有特定属性的XML子元素的索引吗 说 foo.child.@attribute //index of 我尝试过这样的方法: foo.child.@attribute.childIndex() 但它返回-1,使用方法对我有效: foo.child.(hasOwnProperty("@attribute")).childIndex() 但如果具有@属性的元素不唯一,则正确的代码为: foo.child.(hasOwnProperty("@att

有人知道是否有方法检索ActionScript中具有特定属性的XML子元素的索引吗

foo.child.@attribute //index of
我尝试过这样的方法:

foo.child.@attribute.childIndex()
但它返回
-1

,使用方法对我有效:

foo.child.(hasOwnProperty("@attribute")).childIndex()
但如果具有
@属性的元素不唯一,则正确的代码为:

foo.child.(hasOwnProperty("@attribute"))[0].childIndex()

工作得很有魅力。谢谢你的帮助。