2 Replies Latest reply on Aug 25, 2009 4:46 AM by Barna Biro

    Error #1034

    hitesh.rawat Level 1

      Hey all,

       

      I'm trying to run a small piece of code here.........however its giving me an error # 1034. I'm also pasting the instrustions.......plz...check and suggest.

       

      the MXML part

       

       

      <mx:LinkButton x="36" y="447" label="Circle" width="226" id="circle" click="drawCircle()"/>

       

       

      the AS part

       

      public function drawCircle():void
              {
             
             
              text1.visible = true;
              text1.text =  "HEllo"//myXML.child(IndexNumber).attribute("source");//.child.length;
             
             
              var size:Number = 100;
              var roundObject:Shape = new Shape();
              // red circular shape
              roundObject.graphics.beginFill(0xFF0000);
              roundObject.graphics.moveTo(size / 2, 0);
             
              roundObject.graphics.curveTo(size, 0, size, size / 2);
              roundObject.graphics.curveTo(size, size, size / 2, size);
              roundObject.graphics.curveTo(0, size, 0, size / 2);
              roundObject.graphics.curveTo(0, 0, size / 2, 0);
                     
              addChild(roundObject);
             
              }

       

       

      Thanks and Regards........

       

      H.R.

        • 1. Re: Error #1034
          RUSH-ME Level 3

          Hi

           

          Instead of adding a shape to the container, add the shape to a uicomponent. Then add that uicomponent to the container. Because when you are attempting to add a child to a mx.core.Container

          the child must implement the interface mx.core.IUIComponent and the Shape class does not implements mx.core.IUIComponent. Here is the sample code.

           

          var myShape:UIcomponent = new UIComponent();

          ...

           

          myShape.addchild(roundObject);

          this.addChild(myshape);

           

          Hope this helps

           

          Regards

           

          Rush-me

          • 2. Re: Error #1034
            Barna Biro Level 3

            Or if you really want to add a Shape, then add it to the rawChildren of the application and not dirrectly to it ( that's why you are getting the error ). But as RUSH-ME said, it would be much better if you work with the Flex API and forget about how you used to do things in Flash.