如何确定 ActionScript3 中 XMLList 中 XML 实例的位置?
罐头上写着什么:我有一个 XMLList,我想找到其中特定 XML 项目所在的位置。第一个索引对于我的目的来说已经足够了。
请注意,我编写一个函数来手动执行此操作没有问题...但我希望 API 中埋有一些可以为我完成此操作的东西。不过我没看到。
What it says on the tin: I have an XMLList, and I want to find where in it a particular XML item falls. First index is good enough for my purposes.
Note that I have no problem writing a function to do this by hand... but I was hoping that the API has something buried somewhere that'll do it for me. I didn't see it, though.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需循环遍历 xmllist 直到找到匹配的列表,然后返回循环中的索引(带有索引的 for 循环)。
Just loop through the xmllist until you find one that matches, then return the index in your loop (for loop with an index).
如果没有代码示例,很难确切地知道您要做什么,但也许 XML.childIndex() 可以解决吗?
Without a code example it's a bit difficult to know what you're trying to do exactly, but maybe XML.childIndex() could the solution?