然后显示两个图像
function addImage(src){
var imageObj = new Image();
imageObj.src = src;
var imagenew = new Kinetic.Image({
x: 80,
y: 80,
image: imageObj,
width: 65,
height: 65,
name:'imagename',
draggable:true
}); // end new image
layer.add(imagenew);
layer.draw();
} //结束addImage
感谢
答案 0 :(得分:1)
您必须使用onload回调来加载imageObj时间:
var imagenew;
var imageObj = new Image();
imageObj.onload=function(){
imagenew = new Kinetic.Image({
x: 80,
y: 80,
image: imageObj,
width: 65,
height: 65,
name:'imagename',
draggable:true
}); // end new image
layer.add(imagenew);
layer.draw();
}
imageObj.src = src;