5 Replies Latest reply on Aug 20, 2010 11:46 AM by Dajji

    Extending UIComponent

    Dajji Level 3

      Quick Flex 3 question...

       

      If I extend UIComponent to create a custom component and I simply create a new ComboBox object in createChildren method and add it on the display list, why won't it be sized as per the default mechanism of Combo Box. Sample code given below. If I take this code, the Combo Box is not visible. If I specify the width and height of Combo Box, it will get visible. My understanding is that creating an object of Combo Box should be enough and it should size automatically as per default sizing of Combo Box. Isn't it?

       

      package myPackage{
      
           import mx.core.UIComponent;
           import mx.controls.ComboBox;
      
           public class MyComp extends UIComponent{
      
                private var cb:ComboBox;
      
                override protected function createChildren():void{
                     cb = new ComboBox();
                     this.addChild(cb);
                }
           }
      }