In case anyone else is interested, the following code does not have
the same problem (so far), and works well enough for my emergency
needs:
<mx:Canvas>
<mx:Repeater>
<mx:repeatEnd>
<![CDATA[
var
n:int = event.currentTarget.dataProvider.length;
const
hGap:Number = 6;
const
vGap:Number = 0;
const
numCols:int = 2;
var
childi:UIComponent;
for(var
i:int=0; i<n; i++){
childi = topicsTile.getChildAt(i) as UIComponent;
childi.x = (i%numCols) * (childi.width + hGap);
childi.y = Math.floor(i/numCols) * (childi.height + vGap);
}
]]>
</mx:repeatEnd>
< --- repeater contents
here ---- >
</mx:Repeater>
</mx:Canvas>
It's not exactly pretty, but it's self-contained and I don't have a
whole lot of time!
Peter
On Dec 11, 2007 12:38 PM, Peter Hall <[EMAIL PROTECTED]> wrote:
> Every now and then, I get the error below. My client is seeing it
> quite regularly and there is no way for the application to recover
> from it - after clicking "dismiss" the screen remains partially drawn
> and no buttons work. It's all internal to Tile/Container and in a
> callLater() so I can't track it down to anything in my own code. The
> dataProvider for the tile is just a binding to an ArrayCollection.
> I've also tried listening for the change events manually and only
> setting it when I know the array has length > 0.
> I can reproduce this much more frequently when profiling in FB3, but
> my client is seeing it a lot just in normal IE plugin.
>
> The error occurs in a fairly innocent line in Tile.as (663):
>
> // Loop over the children to find the max child width and height.
> var n:int = numChildren;
> for (var i:int = 0; i < n; i++)
> {
> var child:IUIComponent = IUIComponent(getChildAt(i));
>
>
> Somehow, while i goes from 0 to numChildren, it gets to be out of bounds.
>
> The full error is:
>
> RangeError: Error #2006: The supplied index is out of bounds.
> at flash.display::DisplayObjectContainer/getChildAt()
> at
> mx.core::Container/getChildAt()[E:\dev\flex_201_borneo\sdk\frameworks\mx\core\Container.as:2369]
> at
> mx.containers::Tile/http://www.adobe.com/2006/flex/mx/internal::findCellSize()[E:\dev\flex_201_borneo\sdk\frameworks\mx\containers\Tile.as:663]
> at
> mx.containers::Tile/measure()[E:\dev\flex_201_borneo\sdk\frameworks\mx\containers\Tile.as:372]
> at
> mx.core::UIComponent/measureSizes()[E:\dev\flex_201_borneo\sdk\frameworks\mx\core\UIComponent.as:5452]
> at
> mx.core::UIComponent/validateSize()[E:\dev\flex_201_borneo\sdk\frameworks\mx\core\UIComponent.as:5398]
> at
> mx.core::Container/validateSize()[E:\dev\flex_201_borneo\sdk\frameworks\mx\core\Container.as:2688]
> at
> mx.managers::LayoutManager/validateSize()[E:\dev\flex_201_borneo\sdk\frameworks\mx\managers\LayoutManager.as:557]
> at
> mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\flex_201_borneo\sdk\frameworks\mx\managers\LayoutManager.as:646]
> at Function/http://adobe.com/AS3/2006/builtin::apply()
> at
> mx.core::UIComponent/callLaterDispatcher2()[E:\dev\flex_201_borneo\sdk\frameworks\mx\core\UIComponent.as:7975]
> at
> mx.core::UIComponent/callLaterDispatcher()[E:\dev\flex_201_borneo\sdk\frameworks\mx\core\UIComponent.as:7918]
>
>
>
> I'm switching to an alternative layout now- Grid or box combinations;
> hopefully that will solve it. But has anyone seen something like this
> before?
>
> Peter
>