4 Replies Latest reply on Aug 5, 2010 8:49 AM by JabbyPandaUA

    Issue of addChild and addElement

    sunny chandel Level 1

      Hi
      I am getting problem with addChild method.
      I am extending the radio button class because I want to give  multiline label to the radio button and therefore overriding its  createChildren method.

      Following lines of code are there in the overriding method:

      public var labelText:String;

      private var labelTextField:IUITextField;

      override protected function createChildren():void{
                  if (!labelTextField)
                  {
                      labelTextField = IUITextField(createInFontContext(UITextField));
                      labelTextField.styleName = this;
                      labelTextField.multiline = true;
                      labelTextField.wordWrap=true;
                      addChild(DisplayObject(labelTextField));
                     
                      labelTextField.height=this.height;
                      labelTextField.width=this.width;
                      labelTextField.text=labelText;
                  }
              }
      Now the problem is I am getting exception on last line of the above code.
      the exception is:

      "addChild() is not available in this class. Instead, use  addElement() or modify the skin, if you have one."

      When I try to use addElement(), it gives me compilation error.