Oh, and to start from scratch, do:

var _xml:XML = <root>;

 

then:

 var xmlNode:XML = <node>;

 [EMAIL PROTECTED] = "somevalue";

_xml.appendChild(xmlNode)

 

Shold give you:

<root>

  <node attr="somevalue" />

</root>

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Tracy Spratt
Sent: Wednesday, April 04, 2007 9:57 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: Tree and Array

 

The main method you will be using is appendChild().  See the docs:

http://livedocs.adobe.com/flex/201/langref/XML.html
<http://livedocs.adobe.com/flex/201/langref/XML.html> 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of nhp_ny
Sent: Wednesday, April 04, 2007 8:41 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Tree and Array

 

ok... i built tree structures in many other languages, so i know how 
to do it. In other langauges i usually use methods to do it .. like:

Tree.AddItem(Key, Item, Parent)

or

set Node = GetNode(parent)
Node.AddChild(key, item)

so, what i need.. are these methods in flex. How can i add data to a 
tree control? i know that i have to first prepare a dataprovider and 
that i can't work directly with the tree control, and you told me to 
use e4x.. so ok... but how? where are the additem() or getparent() or 
whatever? i saw the manuals for e4x, and found out that its need to 
manipulate xml files, but all the samples in the manual just show how 
to delete , add or modify xml data from an existing xml structure.
thats not my case... i need to start with an empty xml.

hope i've been clear.

thanks

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> You must build either XML, or an ArrayCollection of 
ArrayCollections.
> 
> 
> 
> Are you asking how to construct the logic to read your array and 
build
> the dataProvider?
> 
> 
> 
> It will depend on the exact character of the array data. For 
example,
> are you assured that a parent will be defined before any of its 
children
> are?
> 
> 
> 
> Tracy
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>

[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of nhp_ny
> Sent: Wednesday, April 04, 2007 3:52 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Re: Tree and Array
> 
> 
> 
> thanks, but i have already seen all these pages. they all talk 
about 
> xml lists and collections. nothing about working with arrays. i 
Know 
> that a tree can also read from an array dataprovider.. so i need to 
> know how to add nodes, branches, elemets , parents or whatever is 
> needed to build a tree from an array of mysql records.
> 
> --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
40yahoogroups.com>
> , "mapper2255" <mapper2255@> 
> wrote:
> >
> > 
> > Here are a couple links:
> > 
> > http://www.adobe.com/devnet/flex/quickstart/working_with_tree/
<http://www.adobe.com/devnet/flex/quickstart/working_with_tree/> 
> <http://www.adobe.com/devnet/flex/quickstart/working_with_tree/
<http://www.adobe.com/devnet/flex/quickstart/working_with_tree/> > 
> > 
> > http://www.flex2components.com/f2cblog/2006/10/16/flex-2-tree-
<http://www.flex2components.com/f2cblog/2006/10/16/flex-2-tree-> 
> <http://www.flex2components.com/f2cblog/2006/10/16/flex-2-tree-
<http://www.flex2components.com/f2cblog/2006/10/16/flex-2-tree-> > 
> > walking-the-tree-method/
> > 
> > I know it was for the Cairgorm Store but I did a keyword on these 
> > archives of: "events tree cairgorm" and got 52 results a lot with 
> > the tree component.
> > 
> > Hope it helps some.
> > 
> > 
> > --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> , "Sal" <nhp_ny@> wrote:
> > >
> > > how? can't find a sample... can't find docs on it... does that 
> > mean 
> > > i'll need to build a tree structure inside an array and then 
pass 
> > it 
> > > to the data provider? if so... are there docs or samples on 
this? 
> > how 
> > > to add an array child of an array element?
> > > 
> > > Thanks
> > > 
> > > 
> > > --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <aharui@> 
wrote:
> > > >
> > > > You have to build up the dataprovider and pass it into the 
> > tree. 
> > > If you
> > > > change the dataprovider later, the tree will notice in most 
> > cases.
> > > > 
> > > > ________________________________
> > > > 
> > > > From: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> 
> > > [mailto:flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> ] On
> > > > Behalf Of Sal
> > > > Sent: Tuesday, April 03, 2007 5:38 PM
> > > > To: flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> 
> > > > Subject: [flexcoders] Tree and Array
> > > > 
> > > > 
> > > > 
> > > > hi,
> > > > i have an array of records received from an amfphp call and i 
> > need 
> > > > to fill a tree control with that data. 
> > > > 
> > > > the array has this format:
> > > > 
> > > > aArr[0].id
> > > > aArr[0].description
> > > > aArr[0].parent
> > > > aArr[0].order
> > > > 
> > > > aArr[1].id
> > > > aArr[1].description
> > > > aArr[1].parent
> > > > aArr[1].order
> > > > 
> > > > ... and so on
> > > > 
> > > > i didn't find any method of the control that adds node or 
that 
> > sets 
> > > > node parent. 
> > > > 
> > > > Any ideas?
> > > > 
> > > > Thanks.
> > > >
> > >
> >
>

 

Reply via email to