[flexcoders] tree control finding patent node

2009-03-02 Thread hworke


   Hi, in a tree control if a leaf node if clicked
   how do I find out which folder it belongs to or
   which node is its parent?

   Regards...



RE: [flexcoders] tree control finding patent node

2009-03-02 Thread Jim Hayes
This actually from a change event, but an itemClicked one is very
similar ...
(It presumes that you use xml as the dataprovider for the tree, and
listen for the event by adding 'change=onTreeChange(event)' in your
trees attributes )

private function onTreeChange(event:ListEvent):void
{
var targetTree:Tree = event.target as Tree; 

 var item:XML = XML(targetTree.selectedItem);
 
 var theParent:XML = item.parent();

}

It does seem a bit unintuitive to get an XML object, but normally that
works fine for what you're likely to want to do, I've found.

Hope that's enough to be helpful!

-Original Message-
From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of hworke
Sent: 02 March 2009 21:18
To: flexcoders@yahoogroups.com
Subject: [flexcoders] tree control finding patent node



Hi, in a tree control if a leaf node if clicked
how do I find out which folder it belongs to or
which node is its parent?

Regards...


__
This communication is from Primal Pictures Ltd., a company registered in 
England and Wales with registration No. 02622298 and registered office: 4th 
Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT 
registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and 
used only by the intended recipient. If you have received it in error, please 
contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 
1010. Please then delete the e-mail and do not disclose its contents to any 
person.
This email has been scanned for Primal Pictures by the MessageLabs Email 
Security System.
__


Re: [flexcoders] tree control finding patent node

2009-03-02 Thread Vivian Richard
 thanks a lot!!

On Mon, Mar 2, 2009 at 1:34 PM, Jim Hayes j...@primalpictures.com wrote:
 This actually from a change event, but an itemClicked one is very
 similar ...
 (It presumes that you use xml as the dataprovider for the tree, and
 listen for the event by adding 'change=onTreeChange(event)' in your
 trees attributes )

 private function onTreeChange(event:ListEvent):void
 {
 var targetTree:Tree = event.target as Tree;

 var item:XML = XML(targetTree.selectedItem);

 var theParent:XML = item.parent();

 }

 It does seem a bit unintuitive to get an XML object, but normally that
 works fine for what you're likely to want to do, I've found.

 Hope that's enough to be helpful!

 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of hworke
 Sent: 02 March 2009 21:18
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] tree control finding patent node

 Hi, in a tree control if a leaf node if clicked
 how do I find out which folder it belongs to or
 which node is its parent?

 Regards...

 __
 This communication is from Primal Pictures Ltd., a company registered in
 England and Wales with registration No. 02622298 and registered office: 4th
 Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK.
 VAT registration No. 648874577.

 This e-mail is confidential and may be privileged. It may be read, copied
 and used only by the intended recipient. If you have received it in error,
 please contact the sender immediately by return e-mail or by telephoning
 +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its
 contents to any person.
 This email has been scanned for Primal Pictures by the MessageLabs Email
 Security System.
 __