Reputation: 229
I read this tutorial and need help with buffering stage. When the user clicks 'save', I want to cache the scene, including all drag & drop elements. I really don't know how I should to do this. If you have any experience with this, please help.
Upvotes: 0
Views: 399
Reputation: 105035
You can use stage.toDataURL
to create a URL or Image of the stage
var myStage;
// have KineticJS convert the stage to a URL
stage.toDataURL({
callback:imageDone
});
// callback after the URL has been created
// here we just make an image of the URL
function imageDone(stageDataURL){
myStage=new Image();
myStage.onload=function(){
// your stage is now an image (myStage);
}
myStage.src=stageDataURL;
}
Upvotes: 1