Tom and Tracy both have good suggestions.  However, I'd recommend using
any of the List based controls, with an itemRenderer, instead of using a
repeater.  Unlike the Repeater component, which instantiates all objects
that are repeated (no recycling), the List based controls instantiate
only objects visible in the list.

"I dont know where I am missing it, but I am only able to remove the
lines from the bottom of the stack"

Your problem is with this line:  myAcc.removeChild(vBoxes.pop());.  Here
you are using the array method "pop"; which always removes the last
element in an array.  While the removeChild method works here, since the
value of the removed array element is returned from pop, this is kind of
a backwards way of controlling the displayList.

There may be some confusion here about collections (data) and the
display list (components).  While you can certainly create an array
and/or arrayCollection of components, it's much easier to create and
maintain a List based control; with an arrayCollection of data bound as
the dataProvider.    Then, as Tom indicated, use the built-in
ArrayCollection methods to add/remove the data; and the display
automatically adjusts.  All that you have to do is something like:

myACC.removeItemAt(myList.selectedIndex) ;

-TH

--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> Yes, unless you have some special needs, using Repeater for your
dynamic
> instantiation will save you a lot of work. Plus Repeater supports
> recycleChildren, which will help with performance over creating and
> removing children.
>
> Tracy
>
> -----Original Message-----
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
> Behalf Of Tom Chiverton
> Sent: Tuesday, May 06, 2008 11:15 AM
> To: flexcoders@yahoogroups.com
> Subject: Re: [flexcoders] Adding/Removing child components
>
> On Tuesday 06 May 2008, kalpkat9 wrote:
> > I dont know where I am missing it, but I am only able to remove the
> > lines from the bottom of the stack and I wish to remove the line
> > items as such with their relevant index.
>
> If you use a Repeater bound to an ArrayCollection of the items, you
> could use
> ArrayCollection.removeItemAt() and it should Just Work.
>
> --
> Tom Chiverton
> Helping to conveniently unleash world-class content
> on: http://thefalken.livejournal.com
>
> ****************************************************
>
> This email is sent for and on behalf of Halliwells LLP.
>
> Halliwells LLP is a limited liability partnership registered in
England
> and Wales under registered number OC307980 whose registered office
> address is at Halliwells LLP, 3 Hardman Square, Spinningfields,
> Manchester, M3 3EB. A list of members is available for inspection at
> the registered office. Any reference to a partner in relation to
> Halliwells LLP means a member of Halliwells LLP. Regulated by The
> Solicitors Regulation Authority.
>
> CONFIDENTIALITY
>
> This email is intended only for the use of the addressee named above
and
> may be confidential or legally privileged. If you are not the
addressee
> you must not read it and must not use any information contained in nor
> copy it nor inform any person other than Halliwells LLP or the
addressee
> of its existence or contents. If you have received this email in error
> please delete it and notify Halliwells LLP IT Department on 0870 365
> 2500.
>
> For more information about Halliwells LLP visit www.halliwells.com.
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>


Reply via email to