ItemRenderer class instances in AS3 are re-used when rendering objects in mx:List. For example, if you provide 500 elements to the list’s dataProvider, and only showing 10 rows in the list output, it will create around just over 10 instances of your ItemRenderer. And every time you scrolls the list, it will use the existing renderers to render those new elements in the list by simply calling the “set data” method. It will be up to you to update the state of the renderer yourself, otherwise you will expect very weird behaviours. So you will need to do update your set data function:
override public function set data(value:Object):void {

    // need to remember to call this = value;
    /* then insert code here to update the state of the renderer */

Leave a Reply

Your email address will not be published. Required fields are marked *