Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import mx.controls.cells.CheckCellRenderer;
- import mx.controls.cells.ICellRenderer;
- /**
- * This class sets the upSkin style based on the current item's rowColor value
- * in the data provider.
- * Make sure the class is marked "public" and in the case of our custom cell renderer,
- * extends the CellRenderer class and implements the ICellRenderer interface.
- */
- public class ZebraStripes extends CellRenderer implements ICellRenderer {
- /**
- * Constructor.
- */
- public function ZebraStripes() {
- super();
- }
- /**
- * This method returns the style definition object from the CellRenderer class.
- */
- public static function getStyleDefinition() {
- return CellRenderer.getStyleDefinition();
- }
- /**
- * This method overrides the inherited drawBackground() method and sets the renderer's
- * upSkin style based on the row's rowColor value in the data provider. For example,
- * if the item's rowColor value is "green", the upSkin style is set to the
- * CellRenderer_upSkinGreen linkage in the library. If the rowColor value is "red", the
- * upSkin style is set to the CellRenderer_upSkinRed linkage in the library.
- */
- override protected function drawBackground(){
- switch (data.rowColor) {
- case "green" :
- setStyle("upSkin", CellRenderer_upSkinGreen);
- break;
- case "red" :
- setStyle("upSkin", CellRenderer_upSkinRed);
- break;
- default :
- break;
- }
- super.drawBackground();
- }
- }
Add Comment
Please, Sign In to add comment