Nyxynyx
Nyxynyx

Reputation: 63667

Removing the Stage in KineticJS

How can the KineticJS Stage be removed?

Problem: stage.removeChildren() successfully removes its children like layers. However stage.remove() does not remove the stage, as shown in the jsfiddle below where console.log(stage) after removing it still shows that the stage has not been removed!!!

The div .kineticjs-content that was created along with a Kinetic.Stage also remained after the .remove() was executed.

jsfiddle: http://jsfiddle.net/jfaUg/

Upvotes: 5

Views: 2785

Answers (2)

Ronan
Ronan

Reputation: 26

You could always add:

stage=null;
document.getElementById("canvas").innerHTML = '';

http://jsfiddle.net/jfaUg/1/

Upvotes: 0

Ani
Ani

Reputation: 1655

The stage cannot be removed as there is no remove function applicable as per the current state of KineticJS.

.remove()
function that you are trying to use is applicable for children of "Container" class (documentation) and not the Container Object itself (Stage extends Container) i.e. to say layer.remove() works but stage.remove() won't

Upvotes: 1

Related Questions