No, you don't, I see you are converting it to e4x XML.  First, skip that
step. Set resultFormat="e4x" on the WebService tag.

 

Change your test snippet:

treeData:XML = 
<Rows>

...

</Rows>

 

Then:

//////skip this var treeData:XML = new XML(ROWS.toString());
//////skip this myData = new XMLListCollection(treeData.Row);


this.dataProvider= treeData; //is this code in a component that extends
mx:Tree? So "this" is a tree?

 

This will produce a tree with a "Rows" root node.  Set showRoot="false"
on the tree to prevent that.

 

Now:

var xlChildren:XMLList = treeData.children();

 

myTree.expandItem(xlChildren[0]); //will expand the first child

 

See the example I posted earlier in this thread for an example how to
search for an id and expand that node. Bacically it is:

var xmlSelect:XML = treeData.row.(@id=="3")[0];

myTree.expandItem(xmlSelect); //will expand the row with id==3;

use ".." or "descendants" to go arbitrarily deep in the tree.

 

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Tuesday, January 22, 2008 7:22 PM
To: [email protected]
Subject: RE: [flexcoders] Re: Tree and ITreeDataDescriptor

 

Wait, wait. Do you have a very good reason for using that obsolete
class?  E4x is much, much more functional.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of hmmmbeer3
Sent: Tuesday, January 22, 2008 4:55 PM
To: [email protected]
Subject: [flexcoders] Re: Tree and ITreeDataDescriptor

 

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> I am not speaking of the tree, but of the xml. It has a root or it is
> not xml. I guess you just have showRoot="false" on the tree?
> 
> 
> 
> When accessing tree nodes, you almost always use the use the 
underlying
> dataProvider, which will be the e4x api.
> 
> 
> 
> What do you want to do with the first-level child nodes?
> 
> 
> 
> Tracy
> 
Tracy,

first let me say thanks for your help so far - its really appreciated.

Now I'm still trying to get my head around data-binding, especially 
with a recursive tree. The raw data comes in as a flash XMLNode (thats 
the api - interface) and here's some sample XML and a code snippet I 
use to populate the tree:

ROWS:XMLNode = 
<Rows>
<Row id="1" name="New South Wales">
<Row id="2" name="Sydney">
</Row>
<Row id="3" name="Queensland"/>
</Rows>

var myData:XMLListCollection;
...
var treeData:XML = new XML(ROWS.toString());
myData = new XMLListCollection(treeData.Row);
this.dataProvider=myData;

The ROWS var is actually a parameter to this method. If there is a 
better or more elegant way to populate the tree, I would love to use it.

As for what I want with the first-level nodes, well nothing now that 
the validateNow() method has made everythign work - I was just curious 
how to get them, and I am still in the dark. How would I call 
getChildren() using the above scenario?

Cheers,

Radek

 

Reply via email to