It's pretty straight-forward to reproduce.  Just do something like:

container.removeChild(c1);
container.removeChild(c2);
container.removeChild(c3);
container.addChild(c4);
container.addChild(c5);
container.addChild(c6);

Just make sure that the components have addedEffects and
removedEffects on them and you'll see the handy-dandy evil error
message. :)

I think the only way I can manage this is to have a utility method
that I call to add and remove components from a container and if the
component has a removedEffect then it queues it up and waits for the
removedEvent to finish before going on with removals. It just seems
like Flex should already be doing that internally instead of partially
removing it, but not really.

--- In flexcoders@yahoogroups.com, "Michael Schmalle"
<[EMAIL PROTECTED]> wrote:
>
> Maybe things like trying to shift into another gear without the
clutch in
> factors into this equation as well.
> 
> You didn't show any code, so I don't know if you are trying to brute
force
> something that in the design of the framework was not a bug to begin
with
> but an implementation.
> 
> Peace, Mike
> 
> On 5/18/07, hank williams <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > On 5/18/07, Matt <[EMAIL PROTECTED]> wrote:
> > >
> > >   That actually does fix it...shouldn't I be able to add and remove
> > > without having to write work-arounds for bugs in Flex though?
> > >
> >
> >
> >
> >
> >
> > Of course... we should outlaw bugs :)
> >
> > Hank
> >
> >  If I wanted that kind of development experience I'd go back to
writing
> > > HTML and JavaScript. ;)
> > >
> > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>,
> > > "Andrew Trice" <andrew.trice@>
> > > wrote:
> > > >
> > > > I noticed that you are using removeEffects on the components.
That is
> > > > the root of your problem. I bet it you took those off, you
wouldn't
> > > get
> > > > the error anymore. In my experience with Flex, I've noticed
that the
> > > > child indexes change when an item is actually removed (when
the effect
> > > > has completed). There is a synchronization issue that occurs
while the
> > > > effect is playing.
> > > >
> > > >
> > > >
> > > > Adding children while a remove effect is playing usually
causes errors
> > > > very similar to what you are experiencing. If you are adding
another
> > > > child, try adding it after the remove effect has finished playing.
> > > Hope
> > > > that helps.
> > > >
> > > >
> > > >
> > > > -Andy
> > > >
> > > >
> > > >
> > > > _____________________________________
> > > >
> > > > Andrew Trice
> > > >
> > > > Technical Lead
> > > >
> > > >
> > > >
> > > > Cynergy Systems, Inc.
> > > >
> > > > http://www.cynergysystems.com
> > > >
> > > >
> > > >
> > > > Blog: http://www.cynergysystems.com/blogs/page/andrewtrice
> > > >
> > > > Email: andrew.trice@
> > > >
> > > > Office: 866-CYNERGY
> > > >
> > > >
> > > >
> > > > ________________________________
> > > >
> > > > From: flexcoders@yahoogroups.com
<flexcoders%40yahoogroups.com>[mailto:flexcoders@yahoogroups.com<flexcoders%40yahoogroups.com>]
> > > On
> > > > Behalf Of Matt Wicks
> > > > Sent: Friday, May 18, 2007 10:23 AM
> > > > To: flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>
> > > > Subject: Re: [flexcoders] Re: Flex is Broken
> > > >
> > > >
> > > >
> > > > I had a similar problem .. never really got to the bottom of
it but I
> > > > found that addChildAt worked while addChild didn't ?
> > > >
> > > > On 18 May 2007, at 15:03, Matt wrote:
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > The exact error message I'm currently getting is as follows:
> > > >
> > > > RangeError: Error #2006: The supplied index is out of bounds.
> > > > at flash.display::DisplayObjectContainer/addChildAt()
> > > > at
> > > > mx.core::UIComponent/http://www.adobe.
> > > > <http://www.adobe.com/2006/flex/mx/internal::$addChildAt>
> > > > com/2006/flex/mx/internal::$addChildAt()
> > > > at mx.core::Container/addChildAt()
> > > > at mx.effects::EffectManager$/::removedEffectHandler()
> > > > at Function/http://adobe. <
http://adobe.com/AS3/2006/builtin::apply>
> > > > com/AS3/2006/builtin::apply()
> > > > at mx.core::UIComponent/::callLaterDispatcher2()
> > > > at mx.core::UIComponent/::callLaterDispatcher()
> > > > at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
> > > > at flash.utils::Timer/flash.utils:Timer::tick()
> > > >
> > > > Just to be clear here though, I'm calling addChild, not addChildAt
> > > > (internally addChild calls addChildAt).
> > > >
> > > > --- In [EMAIL PROTECTED] <mailto:flexcoders% <flexcoders%25>
> > > 40yahoogroups.com>
> > >
> > > > ups.com, "Matt" <matt@> wrote:
> > > > >
> > > > > I have been using Flex for quite a while now and I've found
quite a
> > > > > few moderate to serious bugs, but the one that keeps slapping my
> > > face
> > > > > when I approach something close to stability is this error:
> > > > >
> > > > > RangeError: Error #2006: The supplied index is out of bounds.
> > > > >
> > > > > This seems to occur due to ActionScript 3's lack of concurrency
> > > > > support. It would seem that if I quickly remove and add several
> > > > > components to a container this shows its ugly head. What
makes this
> > > > > particularly scary is that the error message appears once
and then
> > > any
> > > > > time I try to do anything at all to the container after that it
> > > throws
> > > > > the same message over and over.
> > > > >
> > > > > I originally saw this appear in reference to popups on the
> > > > > SystemManager container and created a work-around to
pre-instantiate
> > > > > windows and just keep them hidden until needed. It was
specifically
> > > a
> > > > > problem when I would use the popup manager to display a menu
and the
> > > > > selection of a menu option would then display a window. What
ended
> > > up
> > > > > happening was that the window would be created and popped up
at the
> > > > > same time the popup was being removed and it would get its
internal
> > > > > indexing off it would seem and never could you do anything
to the
> > > > > SystemManager container again.
> > > > >
> > > > > Is there a way to add and remove items "safely" or is this a
known
> > > bug
> > > > > and one I just have to live with until Adobe gets around to
fixing
> > > it?
> > > > >
> > > >
> > >
> > >
> >  
> >
> 
> 
> 
> -- 
> Teoti Graphix
> http://www.teotigraphix.com
> 
> Blog - Flex2Components
> http://www.flex2components.com
> 
> You can find more by solving the problem then by 'asking the question'.
>


Reply via email to