I’d like to ask this question which has been popping up on my mind often.
Why do i get this error saying parent does not exist when I try to remove a movieclip. In the first case, the movieclip cannot exist either on screen/memory if it was not ‘contained’ by either a movieclip or stage
How can this happen, can somebody explain how this “movieclip” loses its parent reference to the stage or container mc. The debugger stack shows the value of movieclip.parent as null.
Would be really helpful even if it were a small comment.
Thank you
Vishnu Ajit
happy coding
there is 2 possibility in this case.
– either movieclip is not added to stage or any container.
– or it’s already removed from parent with some other mistake in code.
To prevent error when remove movieclip from parent.
use this simple code to remove movieclip.
if(movieclip.parent)
movieclip.parent.removeChild(movieclip);
it will prevent this error