Copy link to clipboard
Copied
Hi how to removeallchild js adobe animate
Copy link to clipboard
Copied
Hi.
- Stop the current timeline by calling the stop method if it has only one frame;
- Call the removeAllChildren method on the parent.
this.stop(); // it's needed if your current timeline has only one frame
this.removeAllChildren(this.yourContainer);
I hope it helps.
Regards,
JC
Copy link to clipboard
Copied
Hi
Its not work
can you send example
please show file
Copy link to clipboard
Copied
https://drive.google.com/file/d/1BRTffs5IDl-7rdCbfBDHDNIMJKCMD-nV/view?usp=sharing
Hi
Its not work
can you send example
please show file
Copy link to clipboard
Copied
You forgot to add the stop method. Also, if you're adding an instance to the stage, you need to remove the instance from the stage as well.
var that = this;
this.buttonAdd.addEventListener("click", addFromLibrary);
this.buttonRemove.addEventListener("click", removeClip);
that.stop();
function addFromLibrary(e) {
window.myRectangle = stage.addChild(new lib.Rectangle());
window.myRectangle.x = that.cur.x
window.myRectangle.y = that.cur.y
}
function removeClip(e) {
stage.removeAllChildren();
}
But please notice that in this way even the buttons will be removed. So you need to add your children to a container and then run the removeAllChildren method on that container.
Regards,
JC
Copy link to clipboard
Copied
thanks
container how I can do it ?