Search code examples
apache-flexactionscript-3itemrendererskin

Flex Button missing its skin inside itemRenderer class


I have tried to create an instance of Button class inside an itemRenderer element instance, but the button instance appears without its skin. can someone explain me :

  • Why does it happends ?
  • How to fix it ?
  • Am I doint it right or not ?
override protected function createChildren():void
{
    super.createChildren();

    btnControl           = new Button();
    btnControl.x         = 2;
    btnControl.y         = 22;
    btnControl.minHeight = 18;
    btnControl.minWidth  = 50;
    btnControl.height    = 18;
    btnControl.width     = Number( undefined );
    btnControl.label     = "контрол";
    btnControl.addEventListener( MouseEvent.CLICK, onBtnControlClick );
}

Solution

  • As far as I can tell from your code you're not adding the button to the displayList. Add

    addElement(btnControl);
    

    at the end if this is a Spark component you're extending; if it's an mx component use

    addChild(btnControl);