Chapter 8. Lists and ItemRenderers

In this chapter, as in some of the other chapters in this book, many of the recipes will need to address both Spark components and MX components. The three MX components covered (List, Tile, and Tree) all extend the mx.controls.listclasses.ListBase class.

On the Spark side, you’ll see how to create renderers for the List component, apply styles, and create layouts for List and other data-driven controls. The Spark List component, along with the Spark ButtonBar component, extends the spark.components.SkinnableDataContainer class. The SkinnableDataContainer enables you to create controls whose children are generated by a data provider, and allows for sorting, filtering, reordering, and the setting of visual components to act as item renderers and item editors. Like the Halo List that you may be familiar with, the Spark List component recycles all the item renderers it creates. This means that if you create 1000 items but only 20 are visible at a given time, only 20 item renderers will be created, and each one’s data will be refreshed as the list is scrolled so that the correct values are displayed. All of these controls also allow for dragging and dropping in slightly different ways, as you’ll learn.

The topics covered in this chapter do not begin to exhaust the possibilities for working with these ListBase controls or with the Spark List and layouts. For recipes on working with skinning, see Chapter 6. For recipes on working with Spark Groups, see ...

Get Flex 4 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.