selectedItem gives you a reference to the node.

 

Probably what you are seeing is because the event is just an Object
containing the xml, so some propeties are not visible.  Cast/convert the
result into an xml object:

var oItem:Object = event.currentTarget.selectedItem;

var xmlItem:XML = XML(oItem)

 

xmlItem will be the node.

 

Tracy

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of TCash21
Sent: Tuesday, February 06, 2007 12:55 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] detect XML node on click in Tree

 

I have a Tree that's populated based on e4x XML, which is generated by
PHP from querying the backend. I have a structure like this:

<projects>
<project>
<experiments>
<experiment>
</experiment>
</experiments>
</project>
</projects>

I'd like to be able to double click on an item in the Tree and change
to the necessary viewStack page, which will allow the user to edit the
info. The viewStack page will depend on whether the user clicked on a
project or experiment. 

So far I've tried using onChange(event),
event.currentTarget.selectedItem, which only gives me certain
attributes. I just want to be able to somehow know which XML node
<experiment> or <project> was clicked so I can open the right window.

I've been reading about ItemRenderers, will I need to use one?
I'm familiar with eventListeners but I'm still unsure about how to get
the appropriate XML node based on a click.

Thanks for any help.

 

Reply via email to