I have an XML object in Flex4 that is populating a tree (amongst other things).
I need to be able to find the name of the selected item when it is clicked in the tree.
For example:
<Object id="">
<Image></Image>
<Cycle></Cycle>
</Object>
<Action>
<Hide></Hide>
</Act开发者_StackOverflow社区ion>
The tags are all predefnied by me so I will know what they are, but I need to be able to know if the item a user has selected is "Object" and do something, or if they select "Action" do something else.
What is the syntax to get the names of these in flex4 and compare them?
Thanks
If you have a reference to the XML node, you can call the name() method:
var xml:XML = <data><myNode/></data>;
trace(xml.child(0).name()); //traces "myNode"
精彩评论