RangeError: Error #2006 when calling updateAllControllers()
Hi, up to yesterday I had a problem where an index out of bounds exception (Error #2006) was thrown after doing a compose()/updateAllControllers() cycle several times, with no apparent reason. Here's the first part of the stack trace (after that just comes the line where updateAllControllers was invoked):
RangeError: Error #2006: El índice proporcionado está fuera de los límites.
at flash.display::DisplayObjectContainer/addChildAt()
at flashx.textLayout.container::ContainerController/addTextLine()
at flashx.textLayout.container::ContainerController/http://ns.adobe.com/textLayout/internal/2008::updateCompositionShapes()
at flashx.textLayout.compose::StandardFlowComposer/updateCompositionShapes()
at flashx.textLayout.compose::StandardFlowComposer/updateToController()
at flashx.textLayout.compose::StandardFlowComposer/updateAllControllers()
I tried to follow the code of ContainerController and StandardFlowComposer, but it was no use. I couldn't get the debugger to work with those files either.
I compared side by side the values of the relevant attributes of the textFlow's flowComposer and of its controllers (composition width and height, absoluteStartPosition, etc.) right before a successful call to updateAllControllers() and just before a call that would fail, and they were absolutely the same.
Finally I solved the problem in a really weird (and not very clean) way: adding and removing one controller from the flowComposer just before issuing the call to updateAllControllers() or compose() (in another part of my code).
if (this._textFlow.flowComposer.numControllers > this._columnas - 1 && this._containers[this._columnas - 1].visible)
{
this._textFlow.flowComposer.removeControllerAt(this._columnas - 1);
this._textFlow.flowComposer.addControllerAt(this._controllers[this._columnas - 1], this._columnas - 1);
}
this._textFlow.flowComposer.compose();
this._textFlow.flowComposer.updateAllControllers();
So, my questions are: which are the factors that could lead to that exception when updateAllControllers() or compose() are called? Does adding and/or removing a controller from the flowComposer change some internal attribute (that was left in an inconsistent state)? Could this be a bug in the framework?
Sorry for not posting the whole code, but it involves several custom classes and its working is quite complex. I tried to reproduce the error in a reduced context, but I couldn't.
Thanks in advance!
