1 Reply Latest reply on Oct 10, 2011 12:18 PM by Flex harUI

    removeEventListener on ItemRenderer

    NilsTT Level 1



      In a mobile application I have a list with items, not large quantities but 'complex' items. The only reason a list is used, is for the out the box scrolling provider by the list.


      Each item is rendered to fill the screen (so only 1 item is displayed at the same time). The problem is that I want to remove the Event listeners on the ItemRenderer when it is no longer visible.


      As flex recycles the Itemrenderer it is possible to do so on the "set data" function but when I scroll down, the previous item renderer is not yet recycled so there is no "set data" in which I can remove the event listeners. So events that are not needed are being generated and processed on an item that is not visible. In other parts of my application I don't care as the events do not occur regularly and the processing is not much work, but for these items events happen regularly and some heavy processing is necesarry so...


      Anybody an Idea as to how to remove the listeners as soon as the item renderer is no longer visible.


      A related question is: is it possible to have a list scroll to the top of an item (not a specific item but have the scrolling stop so that the top of the item is aligned with the top of the list).


      Thanks in advance