5 Replies Latest reply on Dec 23, 2008 11:49 AM by Newsgroup_User

    public override clone() -- errors

    jeffcg2
      I'm working thru Adobe Flex 3 Training from the Source. And the CD is a Silver Frizbee. So there seems to some critical stuff that was on the CD.

      The product.as file is giving these errors, I read the error that there is supposed to be a clone() class.
      When I look in the Flex 3 help at all the classes there is none.
      Was there a clone() class?
      Is there a Library missing?
      Or ??????

      ----------------------------------------------------------------------------------------- --------------
      package events
      {
      import flash.events.Event;

      import valueObjects.Product;

      public class ProductEvent extends Event
      {
      public var product:Product;
      public function ProductEvent(product:Product, type:String);
      {
      super(type);
      product = prod;
      }
      }

      public override function clone():Event
      {
      return new ProductEvent(product, type);
      }
      }
      -------------------------------------------------------------------------
      Errors
      ----------------------------------------------------------------------
      Severity and Description Path Resource Location Creation Time Id
      1010: The override attribute may be used only on class property definitions. FlexGrocer/src/events ProductEvent.as line 17 1230044682890 5615

      Severity and Description Path Resource Location Creation Time Id
      1020: Method marked override must override another method. FlexGrocer/src/events ProductEvent.as line 17 1230044682896 5616
      --------------------------------------------------------------------
        • 1. Re: public override clone() -- errors
          Xilian
          does line 17 refer to this: return new ProductEvent(product, type); ? I guess the compiler is complaining about "type"
          • 2. Re: public override clone() -- errors
            jeffcg2 Level 1
            I commented out that line and get the same errors.

            I'm guessing they have created a custom class that is one of the things I am supposed to get from the CD.
            • 3. Re: public override clone() -- errors
              Level 7
              I think you just have your curly brackets in the wrong place.

              There should be two sets of closing curly brackets after the end of your
              function statement

              (1) close of the class definition
              (2) close of the package

              Note that you have that first one after the end of the constructor.

              HTH;

              Amy

              "jeffcg2" <jeff@holipub.com> wrote in message
              news:gir2ku$cfd$1@forums.macromedia.com...
              > I'm working thru Adobe Flex 3 Training from the Source. And the CD is a
              > Silver
              > Frizbee. So there seems to some critical stuff that was on the CD.
              >
              > The product.as file is giving these errors, I read the error that there is
              > supposed to be a clone() class.
              > When I look in the Flex 3 help at all the classes there is none.
              > Was there a clone() class?
              > Is there a Library missing?
              > Or ??????
              >
              >
              > --------------------------------------------------------------------------------
              > -----------------------
              > package events
              > {
              > import flash.events.Event;
              >
              > import valueObjects.Product;
              >
              > public class ProductEvent extends Event
              > {
              > public var product:Product;
              > public function ProductEvent(product:Product, type:String);
              > {
              > super(type);
              > product = prod;
              > }
              > }
              >
              > public override function clone():Event
              > {
              > return new ProductEvent(product, type);
              > }
              > }
              > -------------------------------------------------------------------------
              > Errors
              > ----------------------------------------------------------------------
              > Severity and Description Path Resource Location Creation Time Id
              > 1010: The override attribute may be used only on class property
              > definitions. FlexGrocer/src/events ProductEvent.as line 17 1230044682890
              > 5615
              >
              > Severity and Description Path Resource Location Creation Time Id
              > 1020: Method marked override must override another
              > method. FlexGrocer/src/events ProductEvent.as line 17 1230044682896 5616
              > --------------------------------------------------------------------
              >


              • 4. Re: public override clone() -- errors
                jeffcg2 Level 1
                Thanks you. This works. I had a couple of typos I could not see before also.

                -------------------------------
                package events
                {
                import flash.events.Event;

                import valueObjects.Product;
                public class ProductEvent extends Event
                {
                public var product:Product;
                public function ProductEvent(prod:Product, type:String)
                {
                super(type);
                product = prod;
                }


                public override function clone():Event
                {
                return new ProductEvent(product, type);
                }
                }
                }
                • 5. Re: public override clone() -- errors
                  Level 7

                  "jeffcg2" <jeff@holipub.com> wrote in message
                  news:giraae$lj4$1@forums.macromedia.com...
                  > Thanks you. This works. I had a couple of typos I could not see before
                  > also.
                  >
                  > -------------------------------
                  > package events
                  > {
                  > import flash.events.Event;
                  >
                  > import valueObjects.Product;
                  > public class ProductEvent extends Event
                  > {
                  > public var product:Product;
                  > public function ProductEvent(prod:Product, type:String)
                  > {
                  > super(type);
                  > product = prod;
                  > }
                  >
                  >
                  > public override function clone():Event
                  > {
                  > return new ProductEvent(product, type);
                  > }
                  > }
                  > }
                  >

                  Did the same thing myself once :-)

                  Now, before I put anything else in a class, I go down to the second curly
                  brace from the bottom and put
                  //end of class

                  That makes sure I don't do it again!