O'Reilly logo

Flex 4 Cookbook by Garth Braithwaite, Joshua Noble, Todd Anderson, Marco Casario, Rich Tretola

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required