var imgObj1Set = new Image(); var imgObj2Set = new Image(); var imgObj3Set = new Image(); var imgObj4Set = new Image(); var loadCountSet = 0; imgObj1Set.onload = function() { loadCountSet++; if(loadCountSet==4) putOnCanvasSet(); }; imgObj2Set.onload = function() { loadCountSet++; if(loadCountSet==4) putOnCanvasSet(); }; imgObj3Set.onload = function() { loadCountSet++; if(loadCountSet==4) putOnCanvasSet(); }; imgObj4Set.onload = function() { loadCountSet++; if(loadCountSet==4) putOnCanvasSet(); }; imgObj1Set.src = ""; imgObj2Set.src = ""; imgObj3Set.src = ""; imgObj4Set.src = ""; function putOnCanvasSet() { var cast_set = new Kinetic.Image({ x: 0, y: 0, image: imgObj1Set, width: 940, height: 615 }); var textures_set = new Kinetic.Image({ x: 0, y: 0, image: imgObj2Set, width: 940, height: 615 }); var shadows_set = new Kinetic.Image({ x: 0, y: 0, image: imgObj3Set, width: 940, height: 615 }); var net_set = new Kinetic.Image({ x: 0, y: 0, image: imgObj4Set, width: 940, height: 615 });