I have a custom componenent which is an extension of VBox. In it I had defined
a RemovedEffect since the user can add and remove these
components to the interface. The problem I had with this is that this effect
caused the program to lock up after I had added and then removed
all components via this method:
<!-- axisInfoArea is a standard VBox component -->
public function removeAllAxes():void {
for (var
k:int=axisInfoArea.getChildren().length-1; k>0; k--) {
axisInfoArea.removeChildAt(k);
}
}
It seems like after I remove them all, then when the Removed Effect gets
called, it tries to apply the effect on components which are no longer
there and causes the following error.
RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/addChildAt()
at
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$addChildAt()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\
core\UIComponent.as:4982]
at
mx.core::Container/addChildAt()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\Container.as:2208]
at
mx.effects::EffectManager$/removedEffectHandler()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\effects\EffectManager.as:738]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at
mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8460]
at
mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8403]
So when I remove the RemovedEffect from my component, the code works fine, but
when it's there, the program freezes up. Is this a known
bug or is there someway around it?