remove child

New Here ,
Jan 25, 2021

Copy link to clipboard

Copied

hello!

i have chalange with remove child

i wrote this code

in button_2  the code removed olny the child from empty but not from empty1

what's wrong in the code??


this["empty"].addChild(new lib["picword14"]());
this["empty1"].addChild(new lib["picword14"]());


this.button_2.addEventListener("click", fl_ClickToGoToAndPlayFromFrame_2.bind(this));

function fl_ClickToGoToAndPlayFromFrame_2()
{
this["empty"].removeChildAt(); 
this["empty1"].removeChildAt();
}


this.button_3.addEventListener("click", fl_ClickToGoToAndPlayFromFrame_3.bind(this));

function fl_ClickToGoToAndPlayFromFrame_3()
{
this["empty"].addChild(new lib["picword14"]());
this["empty1"].addChild(new lib["picword14"]());
}

Views

35

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jan 26, 2021

Copy link to clipboard

Copied

Hi.

 

You're using the removeChildAt method which requires an index. E.g.:

this["empty"].removeChildAt(0);

 

Just provide an index or use the removeChild method instead.

 

Regards,

JC

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Yigal0D4B AUTHOR LATEST
New Here ,
Feb 03, 2021

Copy link to clipboard

Copied

thank you

it its work

Likes

Translate

Translate

Report

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