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

问题描述:

有谁知道是否有办法在ActionScript中检索具有特定属性的XML子元素的索引?如何在AS3中检索具有特定属性的XML元素的索引?

说...

[email protected] //index of 

我尝试使用方法是这样的:

[email protected]() 

但它返回-1

使用hasOwnProperty方法为我工作:

foo.child.(hasOwnProperty("@attribute")).childIndex() 

但如果与@attribute元素是不是唯一的,那么正确的代码是:

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

工作就像一个魅力。谢谢您的帮助。 – Pori