If you assume Arrays, and you can efficiently find the index, then you can use getItemAt to get the previous item. listData.rowIndex might be useful
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Sent: Wednesday, February 06, 2008 1:24 PM To: [email protected] Subject: [flexcoders] Display Custom ItemRenderer based on previous value in List I am trying to solve a certain design problem and am not sure how to approach this. I have a List control which displays data using a custom ItemRenderer. I currently listen for a dataChange event and set different properties of the ItemRenderer based on the data that is being set. That all works fine. (although it could use some refactoring for performance). However, I now want to set some additional properties based on how this data compares to the data of the previous item in the list's dataProvider. I am struggling to find the best way to do this. I can get access to the DataProvider though this.owner.dataProvider, but then I would need to set up a new cursor, find the current item in the list and then movePrevious() to compare to the previous item. Of course this would have to happen each time they renderer was created for a new item in the list. Can anyone think of another more efficient way to achieve this? Along the same lines, it would also be nice to create separators in List controls, but I haven't figured a way to do this either. For example, if you are displaying a list of 20 scheduled events, it would be nice to be able to create separator for each different day that the events happen on. I am guessing I may have to look into extending the List component for this. - Kevin

