Button inside a mc to unload itself
Hi everyone,
The title is pretty self explanatory. I know this subject I've been previously covered but it still unclear with the code I'm using. Please help.
This is the code I put on the main movie clip to load it:
var request:URLRequest = new URLRequest("externalMC.swf");
var loader:Loader = new Loader();
loader.load(request);
addChild(loader);
and this is the code inside the externalMC that contains a button called closeButt
closeButt.addEventListener(MouseEvent.CLICK,closeT );
function closeT(e:Event):void{
this.parent.removeChild(this);
}
I'm doing something wrong obviously but I know I'm not far from the answer, just can't get it...
Thanks