You need to use selecteNode for a TreeDataProvider.

Also look at the TreeDataProvider API, especially getData(), getProperty().

Note that while your data is xml, Flex is changing it into an object.  If you want to work with true xml nodes in your tree, set resultFormat="xml" on the HTTPService tag. 

You can still use the data provider api, or you can use the xml class properties and methods.

Tracy

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alin DICU
Sent: Thursday, May 11, 2006 4:35 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] difficulties accessing tree branches

Anyone, has some examples of accessing tree elements?

Thanks,

Alin DICU a écrit :
> Hi,
>
> I'm having problemes accessing clicked branches in trees. I tried many
> thing but I keep stumbling on undefined items.
>
> Here are piéces of my code:
>
> ------------------------------------- the UI tree component
> -------------------------------
> <mx:Tree id="employeeTree" dataProvider="{treeHttpSrv.result}"
> width="100%" nodeOpen="dataController.onTreeClick(employeeTree)"
> height="100%"/>
>
> ----------------------------------- the httpservice which works
> ----------------------------
>     <mx:HTTPService
>         id="treeHttpSrv"
>         concurrency="multiple"
>         method="GET"
>         url="" href="http://localhost:8084/FlexXMLServer/XMLTreeElementsServlet">http://localhost:8084/FlexXMLServer/XMLTreeElementsServlet"
>         showBusyCursor="true"
>         fault="alert(event.fault.faultstring);"/>
>
> --------------------------------- the format of the XML object send by
> the servlet---------
>
> <Albums>
>     <label>Albums</label>
>     <nomAlbum>
>         <label>BMW</label>
>         <nomPhoto>
>             <label>BMW 325ci 1994</label>
>             <urlPhoto>http://localhost:8080/FlexXMLServer/Photos/BMW/BMW
> 325ci 1994.jpeg</urlPhoto>
>         </nomPhoto>
>     </nomAlbum>
> </Albums>
>
> ------------------------------- the DataController function
> -------------------------------
>
> public function onTreeClick(event):Void
> {
>     trace(event.selectedItem);
> }
>
> It seems I can't get a proper handler on the tree so I can extract the
> urlPhoto attriburte from the xml.
>
> Could someone please redirect me to some working examples or give some
> tips?
>
> Thank,
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
>
>
>
> SPONSORED LINKS
> Web site design development
> <http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ>
>       Computer software development
> <http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw>
>       Software design and development
> <http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ>
>
> Macromedia flex
> <http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZI36cYzBjw>
>       Software development best practice
> <http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw>
>
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
>     *  Visit your group "flexcoders
>       <http://groups.yahoo.com/group/flexcoders>" on the web.
>       
>     *  To unsubscribe from this group, send an email to:
>        [EMAIL PROTECTED]
>       <mailto:[EMAIL PROTECTED]>
>       
>     *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links










--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to