I have a script which at some point MIGHT remove a child
removeChild(obj[2]);
At the end of script I need another script which has to remove the child if it is still present. I thought that
if(obj[2]){
removeChild(obj[2]);
}
would do the trick. But even if it’s removed in first part, then the second part still tries to remove it (it still sees obj[2] as TRUE) even though it already was removed from stage. Results in error
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
Am I doing something wrong here?