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: [EMAIL PROTECTED]

Office: 866-CYNERGY 

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Matt Wicks
Sent: Friday, May 18, 2007 10:23 AM
To: [email protected]
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%40yahoogroups.com>
ups.com, "Matt" <[EMAIL PROTECTED]> 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?
>




 

 

Reply via email to