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

remove child

Explorer ,
Jan 25, 2021 Jan 25, 2021

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"]());
}

149
Translate
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 ,
Jan 26, 2021 Jan 26, 2021

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

Translate
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
Explorer ,
Feb 03, 2021 Feb 03, 2021
LATEST

thank you

it its work

Translate
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