首先我创建一个id为:image1.then的图像我想将id image1更改为image2并使用id:image1创建新图像...我试过但它不起作用。任何人都可以帮助我吗?
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
});
答案 0 :(得分:0)
var kk=stage.find("#image1")[0];
kk.setId("image2");