Flash CS3 AS3.0 removeChild Problem

Hi all,

I am new to the site but have looked through other posts and can’t find a solution to my problem.

I have a movie clip object (image gallery) that is loaded perfectly, but when I goto another part of my movie the object remains. I can do a stage.removeChild(???); in my button script which works. However when the gallery doesn’t exist I get an error message, how can I check if the object exists first:- i.e.

if(stage.getChildByName("???") != null){
stage.removeChild(???);
}

I have tried the code above but it never gets into the IF statement as the condition is never met. maybe “stage” should be something else but I add using stage.addChild(???);
I presume the childs name will be its instance name, I have tried with and without quotes.

Can anyone suggest what might be wrong?

Thanks

Chris