0

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.

1 Answer 1

1

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()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.