# Can't addchild within this class?

**URL:** <https://forum.kirupa.com/t/cant-addchild-within-this-class/310419>\
**Category:** flash\
**Created:** [June 9, 2010, 5:22pm UTC](https://forum.kirupa.com/t/cant-addchild-within-this-class/310419 "2010-06-09T17:22:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jany](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jany](https://forum.kirupa.com/u/jany)\
**Post date:** [June 9, 2010, 5:22pm UTC](https://forum.kirupa.com/t/cant-addchild-within-this-class/310419/1 "2010-06-09T17:22:36Z")

</div>

I may be losing my mind. I am simply trying to add a textfield and addchild to that textfield.

Here is the textfield class

```auto
package {
	
    import flash.display.*;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;

    public class TextTween {
       // public var label:TextField;
       // public var labelText:String;
		
         public function setLabel(str:String) {
           var labelText:String = str;
			
		   configureLabel(labelText);
			
        }
       
        public function configureLabel(labelText:String):void {
          var tField:TextField = new TextField();
			tField.text = labelText;
			tField.x = 200;
			tField.y = 200;
            tField.autoSize = TextFieldAutoSize.LEFT;
            tField.background = true;
            tField.border = true;
            var format:TextFormat = new TextFormat();
            format.font = "Verdana";
            format.color = 0xFF0000;
            format.size = 10;
            format.underline = true;
            tField.defaultTextFormat = format;
                    // addChild(tField);
		    trace (tField.text); // traces out perfectly
			
        }
		
		
    } // end class
} // end package

```

This is how I am calling it from Frame 1

```auto
var texty:TextTween = new TextTween();
var blah:String = "blabbers";
texty.setLabel(blah);

```

Works great until I try to addChild to that textField from either Frame 1 or the class itself. I can trace it perfectly, trace the class, trace the functions, trace everything in the functions but I can not addChild. Ugh. Anybody know whats going on? This is scaring me.:look:
