Going out on a limb here but try changing the one line of code that injects
an child object to...

Object(myCollection[0]).children= obj;

Charles P.



On Fri, May 8, 2009 at 3:04 PM, timgerr <tgallag...@danati.com> wrote:

> Thanks for the response, I have a question about arraycollection and
> trees.  If I do this:
>
> var myCollection:ArrayCollection = new ArrayCollection([{first: 'Matt',
> last:'Matthews'}, {first: 'Tom', last: 'Jones'}]);
>
> var obj:Object = new Object();
> obj.first = 'lisa';
> obj.last = 'griffen';
>
> Object(myCollection[0]).obj = obj;
>
> then create a tree:
> <mx:Tree x="137" y="176" width="422" id="meSmallTree"
> dataProvider="{myCollection}"
>         labelFunction="GetTreeLable"
> click="ItemClicked(event)"></mx:Tree>
>
> I only see the first 2 names, Matt and Tom.  How do I have the new
> object show as a child of the Matt?
>
> Thanks,
> timgerr
>
> PS, how did you do he color in your code????
>
>
> --- In flexcoders@yahoogroups.com, "Tim Hoff" <timh...@...> wrote:
> >
> >
> > Ah, ok.  The first item in the arrayCollection is an Object.  So, you
> > would have to do something like this:
> >
> > var myCollection:ArrayCollection = new ArrayCollection([{first:
> 'Matt',
> > last:'Matthews'}, {first: 'Tom', last: 'Jones'}]);
> >
> > var obj:Object = new Object();
> > obj.first = 'lisa';
> > obj.last = 'griffen';
> >
> > Object(myCollection[0]).obj = obj;
> >
> > -TH
> >
> > --- In flexcoders@yahoogroups.com, "timgerr" tgallagher@ wrote:
> > >
> > > I want to add it as a child to the first item in the arraycollection
> > (myCollection[0]). Can this be done???
> > >
> > > Thanks,
> > > timgerr
> > >
> > > --- In flexcoders@yahoogroups.com, "Tim Hoff" TimHoff@ wrote:
> > > >
> > > >
> > > > Have you tried myCollection.addItemAt(obj,0);?
> > > >
> > > > -TH
> > > >
> > > > --- In flexcoders@yahoogroups.com, "timgerr" <tgallagher@> wrote:
> > > > >
> > > > > I want to add items to an arraycollection as a child
> > > > >
> > > > >
> > > > > --- In flexcoders@yahoogroups.com, "timgerr" tgallagher@ wrote:
> > > > > >
> > > > > > Hello all,
> > > > > > I have a question for you all. I was wondering how I can add a
> > child
> > > > to an object within a arraycollection. Here is what I mean:
> > > > > > var myCollection:ArrayCollection = new
> ArrayCollection([{first:
> > > > 'Matt', last: 'Matthews'}, {first: 'Tom', last: 'Jones'}]);
> > > > > >
> > > > > > var obj:Object = new Object();
> > > > > > obj.first = 'lisa';
> > > > > > obj.last = 'griffen';
> > > > > >
> > > > > > I would like to add the new object to be a child of the first
> > item
> > > > in the array list. Can this be done??
> > > > > >
> > > > > > Thanks,
> > > > > > timgerr
> > > > > >
> > > > >
> > > >
> > >
> >
>
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location:
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>

Reply via email to