If(variable exists)

Hi kirupa,

I’ve got a movieclip in my library which can have another movieclip inside it. Now I want to check if it’s there. Searching online gives:

var mc1:MovieClip = new MC1();
if(mc1.mc2)
    //mc2 exists

but this code will give me an compile error when ‘mc2’ does not exist:

1119: Access of possibly undefined property mc2 through a reference ....

Is there anyway to get what I want?