简体   繁体   中英

Remove a MovieClip located inside another MovieClip using AS from stage

I have two movieclips.

First movieclip is on the stage with an instance name: main

Second movieclip is inside the first movieclip, with an instance name: temp_bar

From the stage I want to remove the movieclip named "temp_bar"

main.removeChild(temp_bar) and removeChild(main.temp_bar) from stage doesn't work.

Thanks in advance.

Assuming temp_bar is an instance name, try using:

main.removeChild(main.getChildByName("temp_bar"));


If there only one child to main always, use:

main.removeChildAt(0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM