Assuming the button exists in the outer swf, you would use something like this:

PHP Code:
function escapeChildSwf(e:Event null):void{
    
removeChild(loader);
    
loader.unload();
    
gotoAndPlay('someFrame');

If the button is inside the child swf, you'll need to dispatch a custom event out of their like so:

PHP Code:
childBtn.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void{
    
dispatchEvent(new Event('killMe'));
}); 
And listen to that event from the parent swf:

PHP Code:
loader.content.addEventListener('killMe'escapeChildSwf);