0 Replies Latest reply on Nov 28, 2006 9:59 AM by upshotvideo

    Error when adding Child to component

    upshotvideo Level 1
      Im using this function in a component, but when i run the app i get the following errror:
      TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Sprite@4992819 to mx.core.IUIComponent.
      How do i create a sprite, and some shapes, and then add that sprite to the Canvas?
      Here is what I'm doing:
      private function drawStage():void{
      var mySprite:Sprite = new Sprite();
      mySprite.graphics.beginFill(0xFFCC00);
      mySprite.graphics.drawCircle(30, 30, 30);
      var label:TextField = new TextField();
      label.text = "hello";
      label.x = 20;
      label.y = 20;
      mySprite.addChild(label);
      this.addChild(mySprite);
      }
      Thanks for any help. Im stumped.