是否有等效于 Array.indexOf 的 XMLList?
例如 -
var array:Array = ['one','two'];
trace(array.indexOf('two')); // returns 1, since it's at the second position
trace(array.indexOf('three')); // returns -1, since it isn't found
... 对?但是如果我有这个怎么办 -
var xml:XML = <list><item>one</item><item>two</item><list>
var xmlList:XMLList = list.item;
与循环遍历所有节点相比,必须有一种更简单的方法来检查 XMLList 中的一个节点是否具有特定值,对吗?类似于-
xmlList.indexOfChildByNodeValue('two'); // returns 1, because it's the second child
xmlList.indexOfChildByNodeValue('three'); // returns -1, because it doesn't match any children
有道理?