1

I have a viewstack with a repeater inside to create each child. Soemthing like that:

    <mx:ViewStack width="100%" height="100%" >
    <mx:Repeater id="myrepeater" dataProvider="{myDataProvider}">
    <mx:HBox width="100%" height="100%" >
    ---view content goes here---
    </mx:HBox>
    </mx:Repeater>  
    </mx:ViewStack>

When I add an item to the dataprovider, it creates the new child, but it also reloads all the other children, which I don't want. How do I prevent Flex from recreating the component when it adds a child?

Thanks.

  • 1
    I'm not sure how helpful this is; but don't use a repeater; XML wasn't designed for loops. Re-write your code in ActionScript.. – JeffryHouser Sep 18 '12 at 15:42

2 Answers2

0

You can't do it "incrementally" with a Repeater, you should do it programmatically instead using the method addChild() which belongs to Container hence it's inherited by, for example, the HBox at the first level inside your Repeater,

cheers

0

If you can use Flex 4 or higher, then use a DataGroup or a List instead of a Repeater. Everything will just work better.

Otherwise, you can try setting recycleChildren=false on the Repeater.

Peter Hall
  • 53,120
  • 14
  • 139
  • 204