Had a stupid bug that cost me a lot of time so I figured I’d post the solution here in case others stumble onto the same problem.
I had an app with a Horizontal List control and for some reason, Flex insisted on adding an extra item to my list whenever I added a new item to it? Strange. This only happened after I converted the project to Flex 4 and when I went back to Flex 3, it worked as it should. I debugged and confirmed that it was getting the correct dataprovider and despite there being only two items in the dataprovider, three items were rendered.
I looked and looked in all the wrong places until I noticed that I was setting “horizontalScrollPosition” to -1? Why on earth was I doing that? Turns out that if you do this, Flex 4 will create the missing item in your list rather than throwing an “out of bounds” error. Hope this helps someone else with a similar problem!07 September 2010 at 6:35 pm