Re: RemoveChild issue in AS3
You need to embed the following code in your program, this will give you the expected result.
Code:
event.target.parent.removeChild(event.target);
and you need to use the best way to clear out a display with this:
Code:
while(myMC.numChildren > 0) removeChild(myMC.getChildAt(0));
Make a container movieclip, attach it, and attach your list items to the container.and If you're looping through a DisplayObject and are basing the loop on numChildren, then no need to remove children as the value of numChildren.
Re: RemoveChild issue in AS3
I found that this is a similar problem to what I was having,The code you have given will help to removes the single instance of the movie clip, but not all instances.Once this has been finalized you would be looping through a DisplayObject and are basing the loop on numChildren, then not all of the children are removed as the value of numChildren changes as you remove the children.
I have used the following way to remove all the children as follows:
Code:
var count:uint = mySprite.numChildren;
for(var i:uint=0;i<count;i++){
mySprite.removeChildAt(0);
}
Here the Used 0 (zero) index for removeChildAt as everytime you remove an item, it shifts everything in the display list down by 1.
Re: RemoveChild issue in AS3
Thanks for the reply, when i apply your given code in the program at that time it works only for some children's but i was unable to remove children's from the others. Is it possible to delete the holder clip entirely and then recreate it when you press the button to display the list.