Hi,
Got the same problem,
Tabnavigator and viewstack seem to have problem with repeaters set to
recycleChildren=true.
I wasn't able to find why and it looks like a flex/flash bug.
Here is a quick workaround I made :
Subclass TabNavigator and override "setChildIndex()" to add a check against
numchildren :
override public function setChildIndex(child:DisplayObject, index:int):void {
if (index < this.numChildren) {
super.setChildIndex(child, index);
}
}
Obviously you loose something, as the newly added component won't appear as
selected, but at least you won't get the ugly exception.
Damien
--- In [email protected], "stu_bot" <stu_...@...> wrote:
>
> Hi,
>
> I'm having an issue using an mx:repeater to display the tabs inside an
> mx:TabNavigator. Using recycleChildren="true" seems to have a problem
> when the underlying dataProvider (an ArrayCollection) is changed.
>
> I've reduced the problem down to the following code:
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
>
> <mx:Script>
> <![CDATA[
> import mx.collections.ArrayCollection;
>
> [Bindable]
> public var a:ArrayCollection = new
> ArrayCollection([1,2,3]);
> ]]>
> </mx:Script>
>
> <mx:Button click="a.addItem(4)" label="Add tab" />
>
> <mx:TabNavigator>
> <mx:Repeater id="rptr"
> dataProvider="{a}"
> recycleChildren="true">
>
> <mx:VBox label="{rptr.currentItem.valueOf()}"
> width="200" />
> </mx:Repeater>
> </mx:TabNavigator>
>
> </mx:Application>
>
>
> Clicking the button results in "RangeError: Error #2006: The supplied
> index is out of bounds."
>
> When recycleChildren="false" I don't get the error.
>
> Has anybody got any suggestions on this one?
>
>
> Cheers,
>
> Stu
>