Yes, a Kinetic save to JSON will not include either event handlers or images.
You must rewire the handlers after the JSON nodes have been deserialized and rehydrated.
With some preparation, you can even automate this rewiring.
For example,
First save all your event handlers in an object or array:
var eventHandlers={
myClickHandler1:function(e){ alert("Fired myClickHandler1"); },
myClickHandler2:function(e){ alert("Fired myClickHandler2"); },
myMouseMoveHandler1:function(e){ alert("Fired myMouseMoveHandler1"); },
myMouseMoveHandler2:function(e){ alert("Fired mymouseMoveHandler2"); }
}
Second add a custom attribute to each Kinetic.Node that needs an event handler:
var circle1 = new Kinetic.Circle({
x:100,
y:100,
radius: 30,
fill: 'red',
stroke: 'black',
strokeWidth: 4,
draggable: true,
clickEvent:"myClickHandler1"
});
Finally after the node has been rehydrated you can automatically rewire the event handlers:
function rewireHandlers(node){
var handler;
// rewire click handler
handler=node.getAttr("clickEvent");
if(handler && eventHandlers[handler]){
node.on("click",eventHandlers[handler])
}
// rewire other event handlers the same way
}
// call for rewiring
rewireHandlers(circle1);