How work gotoAndStop?

i have problem with gotoAndStop:

btn2.addEventListener(MouseEvent.CLICK, TransitionFrame)


function TransitionFrame(e:MouseEvent):void {
    mc1.mc2.gotoAndStop("frames2");
    
}

but not work, and i see error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

How fix?