• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Hi how to removeallchild js adobe animate

Community Beginner ,
Dec 23, 2021 Dec 23, 2021

Copy link to clipboard

Copied

Hi how to removeallchild js adobe animate

Views

182

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 23, 2021 Dec 23, 2021

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 23, 2021 Dec 23, 2021

Copy link to clipboard

Copied

Hi 

Its not work 

can you send example    

 

please show file 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 23, 2021 Dec 23, 2021

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 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 23, 2021 Dec 23, 2021

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 23, 2021 Dec 23, 2021

Copy link to clipboard

Copied

LATEST

thanks

 

container     how I can do it ?

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines