2 Replies Latest reply on May 6, 2008 8:27 AM by JayStang

    Copy Display Object

    JayStang Level 1
      Hey Guys,
      Is there a way to create an exact copy of a display object and all its children to add some where else on the canvas? So basically if i have an HBox with 3 labels, i would like to assign it to a new variable. Right now if i try this when i do "addChild(obj)" it will move the original object to the new location where it is added instead of having 2 instances on the canvas.

      Any help would be great.
      Thanks,
      ~Jamie
        • 1. Re: Copy Display Object
          dietmar.paulus Level 1
          Hey

          AFAIK there is no automated way to copy a display object, you have to implement the clone or copy method by yourself

          cheers
          • 2. Re: Copy Display Object
            JayStang Level 1
            quote:

            Originally posted by: dietmar.paulus
            Hey

            AFAIK there is no automated way to copy a display object, you have to implement the clone or copy method by yourself

            cheers



            I've attemped to use the ObjectUtils.Copy() menthod but have had no luck. Is this what you are refering to? If so i remember recieving an error saying it cannot convert type display object to type object. If not can you post an example of what you mean? Thanks.