This one was a bit weird for me. I found a lot of posts online about the error but the one’s pertaining to the Repeater component didn’t help at all. Well…I shouldn’t stay “at all” since one of them did make mention of the stack trace not being specific to the code they wrote. So that did prompt me to look at the stack trace.
For reference, here’s the trace:
bq. RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/addChildAt()
at mx.core::UIComponent/https://www.adobe.com/2006/flex/mx/internal::$addChildAt()
at mx.core::Container/addChildAt()
at mx.effects::EffectManager$/removedEffectHandler()
at Function/https://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()
at mx.core::UIComponent/callLaterDispatcher()
Hrmm…look at this line specifically:
bq. at mx.effects::EffectManager$/removedEffectHandler()
Why in the heck is the _EffectManager_ concerned with me calling _removeAll()_ on the bound _ArrayCollection_?
Here’s the answer:
bq. <mx:VBox xmlns:mx=”https://www.adobe.com/2006/mxml” resizeEffect=”Resize” **removedEffect=”Fade”**>
That’s what I get for trying to mess with animations!! 🙂 I nixed _removedEffect_ and everything works fine, as it once did.
I have to get back to dev’ing so I didn’t spend time figuring out why but here’s my speculation:
The _Repeater_ is notified of the collection updates and removes all children. The _EffectManager_ is attempting to animate each child but in doing so a race condition occurs where the _Repeater_ has nixed “item N” and the _EffectManager_ is trying to access it. Since it isn’t there you Error #2006 due to it accessing an item in an array that doesn’t exist.
Hopefully this helps someone else as Google didn’t provide much for my specific scenario.