如何使用 kineticjs 更改图像的 id

How to change id of image using kineticjs

首先,我使用 id:image1 创建了一个图像。然后我想将 id image1 更改为 image2 并使用 id:image1 创建新图像...我试过了,但它不是 working.can有人帮我吗?

            var image = new Kinetic.Image({
                    name: data,
                    id: "image1",
                    x: stage.getWidth()*0.5-20,
                    y: stage.getHeight()*0.5-125,
                    width:20,
                    height:250,
                    image: theImage,
                    draggable: false
                });
         image.setId("image2");
         var image = new Kinetic.Image({
                        name: data,
                        id: "image1",
                        x: stage.getWidth()*0.5-200,
                        y: stage.getHeight()*0.5-125,
                        width:20,
                        height:250,
                        image: theImage,
                        draggable: false
             });
      var kk=stage.find("#image1")[0];
      kk.setId("image2");