# Help with the CellRenderer class for a comboBox

**URL:** <https://forum.kirupa.com/t/help-with-the-cellrenderer-class-for-a-combobox/269527>\
**Category:** flash\
**Created:** [August 28, 2008, 4:13pm UTC](https://forum.kirupa.com/t/help-with-the-cellrenderer-class-for-a-combobox/269527 "2008-08-28T16:13:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwiley63](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mwiley63](https://forum.kirupa.com/u/mwiley63)\
**Post date:** [August 28, 2008, 4:13pm UTC](https://forum.kirupa.com/t/help-with-the-cellrenderer-class-for-a-combobox/269527/1 "2008-08-28T16:13:36Z")

</div>

I am trying to dynamically skin a ComboBox at runtime, based on color values I am reading from a database using amfphp. Everything is working great, except for one thing.

I am having problems extending the CellRenderer class.

I current have this:

```auto
var mySkin:CustomCellRenderer = new CustomCellRenderer(color1, color2, color3);
myCB.dropdown.setStyle("cellRenderer", mySkin);

```

Then in my custom cell renderer class I have:

```auto
package {
  import fl.controls.listClasses.CellRenderer;
  import flash.text.TextFormat;
  import OverSkin;
  import UpSkin;
  import DownSkin;
  public class CustomCellRenderer extends CellRenderer{
    private var _rectangle:Shape;
    private var _bgColor:uint;
    private var ov:OverSkin;
    private var dow:DownSkin;
    private var up:UpSkin;
    public function CustomCellRenderer (Color1:uint,Color2:uint, Color3:uint) {
           ov = new OverSkin(Color1);
        dow = new DownSkin(Color2);
        up = new UpSkin(Color3);
        setStyle("upSkin",up);
        setStyle("downSkin",dow);
        setStyle("overSkin",ov);
        setStyle("selectedUpSkin",up);
        setStyle("selectedDownSkin",dow);
        setStyle("selectedOverSkin",ov);
    }
  }
}

```

This all seems to be working fine, but I am running into one problem.  
I click the comboBox to pull up the drop down, and it displays fine, I select an item and the drop down closes. I then go back to click the combobox and I get the following error:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.  
at flash.display::DisplayObjectContainer/removeChild()  
at fl.controls::List/drawList()  
at fl.controls::List/draw()  
at fl.core::UIComponent/drawNow()  
at fl.controls::List/scrollToIndex()  
at fl.controls::SelectableList/scrollToSelected()  
at fl.controls::ComboBox/open()  
at fl.controls::ComboBox/onToggleListVisibility()

Can anyone point me to a tutorial or some sample code of how to implement the cellRenderer for a comboBox? I have been searching everywhere but cannot seem to find any good examples.
