title: Variable addChild is not defined?
body: <p>i have a problem using AS3 - Flash CS3 gives me this Error message: Error #1065: Variable addChild is not defined.</p>
  
  <p>Any ideas what's wrong?</p>
  
  <p>This is my code:</p>
  
  <pre><code>package coa.application{
      import flash.display.SimpleButton;
      import flash.text.TextField;
      import flash.text.TextFieldType;
  
      public class Tab extends SimpleButton {
  
          public var menuType:String;
  
          public function Tab(tabText:String, menuType:String) {
              this.menuType=menuType;
              var mytext:TextField=createTextField(0,0,200,20);
              mytext.text=tabText;
          }
          private function createTextField(x:Number, y:Number, width:Number, height:Number):TextField {
              var result:TextField = new TextField();
              result.x=x;
              result.y=y;
              result.width=width;
              result.height=height;
              addChild(result);
              return result;
          }
      }    
  }
  </code></pre>