I am using a repeater to display thumbnails. The repeated component is a custom component includes a setter for the image property. When the setter runs, it loads an external image.
The problem is that when I change the repeater's data provider, it appears that the setters for the images fire twice; once when the data provider is changed but before the repeater starts, and then again when the repeater runs. As a result, each component loads it's image twice, which uses extra bandwidth. Plus, if the new data provider has less items than the one it's replacing, the existing repeated components that are beyond the number of the new components, try to load an image that there is no data for, resulting in a browser error. This happens weather recycleChildren is true or false. I made a bare bones test, and it did the same thing, so I'm guessing this is normal behavior. So, what should I be doing differently so that the setters don't fire twice? Here's the repeater code: <mx:Repeater id="myRepeater" repeatStart="{trace('repeatStart')}"> <local:myBox myText="{XML(myRepeater.currentItem).text}"/> </mx:Repeater> Here's the custom component: <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100" height="100"> <mx:Script> <![CDATA[ [Bindable] private var _myText:String; public function set myText(val:String):void { trace("setter called") _myText = val; } ]]> </mx:Script> <mx:Box backgroundColor="0xFFFFFF"> <mx:Label text="{_myText}"/> </mx:Box> </mx:Canvas>