Flash AS3 Component CellRenderer Styles

July 1st, 2011 by Kawika Heftel

Adobe’s documentation for their components sucks. I spent hours the other day figuring out how to style the cells in a ComboBox. I figured I’d post the solution I found here, to save myself and others future grief.

To style the ComboBox itself, you can set “styles” by using the setStyle function, and this is documented on the ComboBox page. It allows you to pass in a class to be used as the skin for various parts of the component in various states, or in some cases a TextFormat object to be used to style text.

But what if you want to ALSO style the cells in the dropdown portion of the ComboBox? Well, then you need to use the setRendererStyle function, whose documentation very hard to find. And it’s the List object that is responsible for styling the cells, not the ComboBox itself. So assuming your combobox is named cb, you’d call cb.dropdown.setRendererStyle. Here is a list of the possible styles that can be set using the setRendererStyle function. This essential information is nowhere on the ComboBox documentation page. Rather, it comes from this esoteric tech article, which took me forever to find.

Anyway, here’s the list of cell styles that can be set. You pass in the class to be used as the skin, i.e. create a symbol in the FLA library, export for ActionScript, and assign it a Class name.
disabledSkin and selectedDisabledSkin
downSkin and selectedDownSkin
overSkin and selectedOverSkin
upSkin and selectedUpSkin

The following styles apply to the text in the cell:

Related posts:

  1. Flash Player 10 maximum bitmap size
  2. ransom note generator
  3. antigravity
  4. 3D MovieClips with Flex and ActionScript 3

Posted in Technology

Tags: , , , , ,

Leave a Reply