AS3 List with custom CellRenderer
This Flash based file-uploading widget is built with Flash CS3 AS3 and uses the new List control with a custom CellRenderer class. The Defining a custom CellRenderer class does an excellent job of describing how to get this done (although I found a few mistakes that I submitted and can be read at the bottom of the link). Specifically, the section titled "To use a library symbol to define a CellRenderer" is what I used.
The use case for going to the trouble of using a custom cellRenderer is when you want all the functionality a List-based display component but need to modify the look and/or functionality of each line. Such is the case with my file-uploading widget where each line has a button and logic to handle the upload process and result.
Getting it to work and look just right took a fair amount tweeking. This was the result.
Breaks after uploading 4 files
If you play with this and add file uploads, you will see that after uploading the 4th file, the new fails to initialize properly, because no button appears. My guess is that as the List is scrolling up, lines that disappear off the top are merely being moved to the bottom thereby saving having to remove a child and reinstantiate a new one. But this is unexpected and breaks file uploader (try and upload more than 4 files).
The answer was to meticulously maintain the state of each line in the data setter of the cellRenderer class. To do this I created a data transport object that represented the data set of the line. This object is used as the data attribute of items in a DataProvider object that is used as a dataProvider for the List. The cellRenderer instance receives the a user click, processes the upload, builds a custom event with data that matches the transport object and dispatches the event. The event bubbles up to Main that replaces the dataProvider item with a new one. NOW when the data setter is called for a file renderer it can access it’s data provider and initialize itself based on what it finds. This is arduous but it works:
fixed!
Here is the source. Comments welcome!

