PDA

View Full Version : removeChild and reset



ricosushi
September 10th, 2008, 06:57 PM
Hi

i added a child (addChild(myCllip) ) and then i change properties of other movieClips inside it then i remove it.

My problem is that when i addChild it again i remains the same when i removed it.

Its there a way to reset the to the original state of the movieClip when i addit again?

Thanks in advance for your help.

creatify
September 10th, 2008, 07:36 PM
I think you'll either have to reset those properties, manually, after it has been removed (keep in mind that even though its removed from the display list, it still exists in its current state in memory)

or

after removing your clip:
myclip = null;
then when re-adding the clip, create a new instance of it
var myclip:MovieClip = new MovieClip();
addChild(myclip);

rosyTown
September 11th, 2008, 01:37 AM
Yeah it's important to remember that removing something from the stage doesn't remove it all together. The object (mc or sprite or whatever) will still reside in memory until it is told explicitly to disappear. To force something out of memory, you must set it to null.

ricosushi
September 11th, 2008, 11:03 AM
it worked for me.

thanks :D

rajpar3
September 18th, 2008, 10:48 AM
Folks

I have the same issue. However, i get the following error message when i do the above:

TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/removeChild()

kbowk
May 10th, 2011, 06:14 PM
I know this post is old but i'm having the same issue as the post above, anyone have any ideas?