10

Pretty simple concept but it doesn't seem to be working. Here is my code:

stage.clear();
stage.update();

Simple stuff -- nothing happens. The docs aren't helping.

skandocious
  • 814
  • 9
  • 21

2 Answers2

20

This ended up working for me:

stage.removeAllChildren();
stage.update();
skandocious
  • 814
  • 9
  • 21
  • 1
    Yeah, it may not be obvious at first that once you add a child to the stage, they're there from now on; they're drown at every update(). The idea is that you add a child once, then just update its position when needed. If you are removing and then adding the same objects during each loop, you are probably doing a lot of extra work. – Ask About Monica Dec 18 '12 at 20:13
  • 1
    Thank you for this. I spent all day searching for a solution like this. – sehummel May 29 '15 at 23:44
2

if you have just one child of shape on that stage and dont want use removeallchildren, you can do this:

myshape.graphics.clear();
stage.update();

if more than one, then loop its children.

axunic
  • 2,256
  • 18
  • 18