Hi, So I think Emile has probably found the issue with this one... it's not really that something is wrong, but since i wasn't seeing trace info, I assumed there was. I'll try adding a child to the selectedNode result and see what I get. I think I started by tracing it and never got to the step where I was adding a child to the result.
I'll post results tonight. Thanks for the help. Brendan --- In flexcoders@yahoogroups.com, "Anatole Tartakovsky" <[EMAIL PROTECTED]> wrote: > > lt is a bit diffucult to understand the problem - however, obvious thing you need to change in the original code when migrating from 1.5: > <mx:Tree id="myTree" dataProvider="{myXML.category}" labelField="@label"/> > > I think Adobe might consider setting default labelField to @label or do conditional expression for the labelField so there are fewer things to port. > Thank you, > Anatole > > > > ----- Original Message ----- > From: Emile Swain > To: flexcoders@yahoogroups.com > Sent: Friday, February 03, 2006 10:02 AM > Subject: RE: [flexcoders] 2.0 Beta Tree.selectedNode > > > Your example is working as expected. The reason you get no output is because the xml node you select has no subelements there for the trace is empty. Trace the label property and you will see you are indeed accessing the xml correctly. > > > > Change your test xml to something glike this > > > > <mx:XML format="e4x" id="myXML" > > > <category label="Element 1" > > > <section label="hello"/> > > </category> > > <category label="Element 2" /> > > </mx:XML> > > > > And your dataprovider to dataProvider="{myXML}" > > > > > > Add the following to your showNode Method > > private function showNode() > > { > > trace("node = " + myTree.selectedItem); > > trace("attribute = " + [EMAIL PROTECTED]); > > } > > > > > > -- > > Emile Swain > > Senior Creative Developer > > Direct: 020 7087 2754 > > > ------------------------------------------------------------------------------ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Brendan Meutzner > Sent: 03 February 2006 14:23 > To: flexcoders@yahoogroups.com > Subject: [flexcoders] 2.0 Beta Tree.selectedNode > > > > Hi, > > I'm obviously missing something, and am hoping someone can fill in the > gap. I have an XML structure using the e4x format... I'm using this > structure as the dataProvider for a Tree component... I'm trying to > examine the XML element that represents a given tree node. So... > > <mx:XML format="e4x" id="myXML"> > <category label="Element 1" /> > <category label="Element 2" /> > </mx:XML> > > <mx:Tree id="myTree" dataProvider="{myXML.category}" /> > <mx:Button label="Show" click="showNode()" /> > > <mx:Script> > <![CDATA[ > private function showNode() > { > trace("node = " + myTree.selectedNode); > } > ]]> > </mx:Script> > > > What I'd like it to have returned is eg. "<category label="Element 1" > />" However, I not receiving anything from the code above. The > strange thing is that If I expand my showNode function to show > "[EMAIL PROTECTED]" I am actually getting the proper label as > a result. The whole purpose of this exercise is to add children to a > selected node, by inserting a child element within the XML structure, > and I need the selected node to determine the parent node of my new child. > > I tried this in 1.5, and got mediocre results. It would return the > proper node result for a branch node, but still return nothing for any > leaf nodes. > > Is what I'm expecting possible, am I asking too much, or is this > perhaps a bug (based on the 1.5 behaviour)? > > Thanks in advance, > > Brendan > > > > > > > > > > > -- > 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 > > a.. Visit your group "flexcoders" on the web. > > b.. To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > > c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. > > > ------------------------------------------------------------------------------ > -- 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 <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/