In Kinetic JS, I want to destroy a sprite and remove it from the layer
The documentation says kinetic.node has the following method:
destroy()
remove and destroy node
the documentation also states for kinetic.sprite:
Methods borrowed from class Kinetic.Node:
…, destroy,…
I assumed that ‘borrowed from’ meant ‘inherited from’, and thought that I would therefore be able to do:
mysprite.destroy()
but this gives me a message telling me that kinetic.sprite has no such method.
I was worried that it might be my version of kineticJS that was out of date, as my version is quite old (v3.10.0), but when I try using the latest version of kineticJS it causes an error in another part of my application, when I try to call the onFrame() method of my kinetic.stage object, telling me that this method does not exist on Kinetic.Stage.
If anyone has any ideas why I can’t call destroy on my kinetic.sprite object, or why when I upgrade to the latest version of kineticJS I am getting an error calling kinetic.stage.onframe then I would very much appreciate it!
try this – it may work with your version