Eh, guess I should have actually tested before sending that out.

 

Change selectedNode.label to selectedNode.getProperty('label')

 

Matt

 

-----Original Message-----
From: brian_r_christian [mailto:[EMAIL PROTECTED]
Sent: Monday, May 03, 2004 6:40 PM
To: [email protected]
Subject: [flexcoders] Re: populating tree with external xml

 

Matt,

I took the liberty of updating the code, and I've put it below. 
Still no dice...not sure why the demo tree online lets you click on
nodes and see the mx:Label's outside the tree change, and our code
wont'.

If you or anyone else has any thoughts, we'd sure appreciate it;
we're stymied. 
Thanks!

Brian

******* tree_new.mxml *********

<?xml version="1.0" encoding="utf-8"?>


<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">

    <mx:Script>
        var selectedNode:Object;
    </mx:Script>


    <mx:Model id="myDebate" source="debate.xml"/>

    <mx:HBox horizontalGap="30">

        <mx:Tree height="200"
change="selectedNode=event.target.selectedItem">
            <mx:dataProvider>
              {myDebate}
            </mx:dataProvider>
        </mx:Tree>

        <mx:Panel id="displayPanel" title="I'm a Panel" width="200">
            <mx:Label text="{selectedNode.label}" id="myLabel"/>
        </mx:Panel>

    </mx:HBox>
</mx:Application>

*******************************

********  debate.xml  *******


<node label="Root Node">
   <node label="Level 1 Node 1">
     <node label="Level 2 Node 1" data="">
     <node label="Level 2 Node 2" data="">
   </node>
   <node label="Level 1 Node 2" data="">
</node>

*****************************************

--- In [email protected], Matt Chotin <[EMAIL PROTECTED]> wrote:
> Hi Josh,
>

>
> You're using a Model which doesn't distinguish between attributes
and child
> properties.  So I think you can do this:
>

>
> <mx:Tree height="200"
> change="selectedNode=event.target.selectedItem ">
>

>
> Then hopefully the rest will work.
>

>
> Matt
>
> -----Original Message-----
> From: joshbronson630 [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 03, 2004 10:03 AM
> To: [email protected]
> Subject: [flexcoders] populating tree with external xml
>

>
> I'm trying to populate an mx:Tree with an external XML document
> consisting only of nested <node> tags with label and data
> attributes. I'm using the Flex Samples Tree example
>
(http://www.macromedia.com/flex/samples/explorer/complib/TreeDemo.mxm
>
<http://www.macromedia.com/flex/samples/explorer/complib/TreeDemo.mxm
>
> l) as a guide. The Tree displays the XML document contents
> correctly, but when I click on a node, the mx:Label I have to
> display the node's data isn't working. Here's the code:
>
>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml
> <http://www.macromedia.com/2003/mxml> ">
>   <mx:Script>
>     var selectedNode:Object;
>   </mx:Script>
>
>   <mx:Model id="myTree" source="tree.xml"/>
>
>     <mx:HBox horizontalGap="30">
>
>       <mx:Tree height="200"
> change="selectedNode=event.target.selectedItem.attributes">
>          <mx:dataProvider>
>            {myTree}
>          </mx:dataProvider>
>         </mx:Tree>
>
>         <mx:Panel id="displayPanel" title="I'm a Panel"
width="200">
>           <mx:Label text="{selectedNode.label}" id="myLabel"/>
>         </mx:Panel>
>     </mx:HBox>
> </mx:Application>
>
>
> Here is what the XML file looks like:
>
> <node label="Root Node">
>   <node label="Level 1 Node 1">
>     <node label="Level 2 Node 1" data="">
>     <node label="Level 2 Node 2" data="">
>   </node>
>   <node label="Level 1 Node 2" data="">
> </node>
>
> Any help would be greatly appreciated.
>
> Thanks!
>
>
>
>
>
>
> Yahoo! Groups Sponsor
>
>
>
> ADVERTISEMENT

>
<http://rd.yahoo.com/SIG=129beum1v/M=295196.4901138.6050264.3001176/D
=groups
> /S=1705007207:HM/EXP=1083690238/A=1874382/R=2/id=noscript/SIG=118tu
uldn/*htt
> p:/companion.yahoo.com/?.cpdl=srch>
>

>
<http://us.a1.yimg.com/us.yimg.com/a/ya/yahoo_companion/302_v1_nws_lr
ec_01.g
> if>
>
>

> <http://us.adserver.yahoo.com/l?
M=295196.4901138.6050264.3001176/D=groups/S=
> :HM/A=1874382/rand=692265631>
>

>
>   _____ 
>
> Yahoo! Groups Links
>
> *         To visit your group on the web, go to:
> http://groups.yahoo.com/group/flexcoders/
> <http://groups.yahoo.com/group/flexcoders/>
>  
>
> *         To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]
subject=Unsubscribe>
>  
>
> *         Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
> <http://docs.yahoo.com/info/terms/>  Service.


Reply via email to