well, I actually need reference to the xml from where the selection occurs..



say this is the XML:

<node label='flash platform' id='1' type='folder' >
   <node label='www.somelink.net' id='2' type='item' feedLocation=' http://www.somelink.net' />
   <node label=somelink' id='3' type='item' feedLocation=' http://www.somelink.com' />
   <node label='bmx biking' id='4' type='folder' >
      <node label='www.somelink.net' id='5' type='item' feedLocation=' http://www.somelink.net' />
      <node label=somelink' id='6' type='item' feedLocation=' http://www.somelink.com' />
   </node>
</node>



if you select flashplatform in the tree.. it should return the entire xml structure...


VS if you select bmx biking, it would spit this out:
<node label='bmx biking' id='4' type='folder' >
     <node label='www.somelink.net' id='5' type='item' feedLocation=' http://www.somelink.net' />
     <node label=somelink' id='6' type='item' feedLocation=' http://www.somelink.com' />
</node>

now if you select an actual item( id=5) it would spit this out:
<node label='www.somelink.net' id='5' type='item' feedLocation=' http://www.somelink.net' />






The next step after getting the XML where the selection has occured, is getting all the individual items in the xml..

so if you select bmx biking, the items i'm looking for are:::
<node label='www.somelink.net' id='5' type='item' feedLocation=' http://www.somelink.net' />
<node label=somelink' id='6' type='item' feedLocation=' http://www.somelink.com' />


Or if you selected "flash platform" the items would look liek this;
<node label='www.somelink.net' id='2' type='item' feedLocation=' http://www.somelink.net' />
<node label=somelink' id='3' type='item' feedLocation=' http://www.somelink.com' />
<node label=' www.somelink.net' id='5' type='item' feedLocation='http://www.somelink.net' />
<node label=somelink' id='6' type='item' feedLocation=' http://www.somelink.com' />



i'm using this so that when you select a folder in the Tree, I can recursively get all the actual Items in the XML (type=item)...
see what I mean? so like, from the folder you've seleted and down it's tree of nodes, it should get the items in its xml..

i hope that explains it better...

or am I complicating this too much? does tree.selectedItem return the xml nodes?

thanks

smith






On 9/24/06, Tim Hoff <[EMAIL PROTECTED]> wrote:

Sure Aaron,

Instead of loopin, have you tried something like this?

var myNode:XML = XML(myTree.selectedItem);

-TH

--- In [email protected], "aaron smith"


<[EMAIL PROTECTED]> wrote:
>
> I am just trying a simple example with trying to parse some xml. I
want to
> be able to find what node is selected according to what is
selected in a
> Tree component.
>
> here is my AS:
>
> private function getSelectedNodeFromSelectedItem( searchXML:* ,
> selectedItem:Object ):XMLList
> {
> var foundNode:*;
>
> for each( var prop:* in searchXML )
> {
>
> if( [EMAIL PROTECTED] == [EMAIL PROTECTED] )
> {
> foundNode = XMLList( prop );
> break;
> }
>
> else if( [EMAIL PROTECTED] == "folder" )
> {
> getSelectedNodeFromSelectedItem( prop.node );
> }
> }
> return foundNode;
> }
>
>
> this is what the XML Looks like: (dataProvider to a Tree )
>
> <node label='flash platform' id='1' type='folder' >
> <node label='www.somelink.net' id='2' type='item' feedLocation='
> http://www.somelink.net' />
> <node label=somelink' id='3' type='item' feedLocation='
> http://www.somelink.com' />
> </node>
>
>
> Say for instance you selected the 2nd child of the flash platform
node. it
> would spit back:
> <node label=somelink' id='3' type='item' feedLocation='
> http://www.somelink.com' />
>
> Say for instance you selected the root node which is a folder. it
would spit
> back:
> <node label='flash platform' id='1' type='folder' >
> <node label='www.smithaaronlee.net' id='2' type='item'
feedLocation='
> http://www.smithaaronlee.net' />
> <node label='teguh mualim' id='3' type='item' feedLocation='
> http://www.capcai.com' />
> </node>
>
>
> It seems to be working correctly to the point where it knows that
the right
> node is selected, but then the return value is of type [object]. I
can't
> figure out how to get it back as a string..
>
> From the results that are spit back from that method I will pass
that value
> to another parsing method to just grab all the individual items
(type=item)
> in the selected node. See what I'm going for?
>
> Maybe I need to cast the xml into an ArrayCollection?
>
> thanks
>


__._,_.___

--
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
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to