5 Replies Latest reply on Jul 5, 2006 5:13 PM by jpwrunyan

    why does addChild(new Shape()) not work?

    jpwrunyan Level 1
      I would like to know why the following code does not work:

      <mx:Application>
      ..
      private function doShape():void {
      var aShape:Shape = new Shape();
      this.addChild(aShape);
      }
      ..
      <mx:Button click="doShape()" />
      </mx:Application>

      according to the docs, addChild() takes a DisplayObject as a parameter. Shape is a DisplayObject. However, I get an error (#1034) that Shape can't be converted to mx.core.IUIComponent

      I don't understand what the problem is...