I am only starting to use kineticJS but I am getting some errors after following
This tutorial
I don’t understand why but I am getting an exception from inside the KineticJS file:
"Uncaught TypeError: cannot call method 'appendChild' of undefined".
When I do a step by step alert()s, I see that it stops after
var stage = new Kinetic.Stage(“rightSide”, 578, 200);
but I most definitively have:
<canvas id="rightSide"> </canvas>
I also tried:
<div id="rightSide"> </div>
and I am getting the same error.
Thanks.
Edit:
in response to the comments below, this is Copy-Paste from the tutorial:
</head> <body> <div id="container"> </div> </body>
There is a change in Kinetic.Stage constructor since March https://github.com/ericdrowell/KineticJS/commit/7ced50f6943af544dbdfc95883ec41728db1d3bd
Thus @Gleeb ‘s own answer reflects current practice in KineticJS v4.0.x instead of those docs / tutorials made in the early v3 era.
Should make a pull request for backward compatibility.. something like
… in the Stage constructor.