Chitra B
Chitra B

Reputation: 13

Kinetic.js removing an image from the layer and redrawing by adding new images

I have created a kinetic.js layer and added some images on it. Now i want to remove all the images and redraw the layer by adding some new images(like a second level images for a game). I have tried using the layer.remove(image) function.

But after the redraw the old images are still shown whereas the new images are not added.

Could anyone help me to solve this issue..?

Upvotes: 0

Views: 2463

Answers (1)

Jonke
Jonke

Reputation: 6533

I use

layer.removeChildren();
layer.draw();
layer.add(newRectWhatever);

and that works for me.

Upvotes: 2

Related Questions