Unloading an swf movie from the swf itself in AS3
I've found many posts in this forum about this but neither solution has worked for me. My setup is as basic as you would think. Main movie loads external swf movie after a mouse click. I need to close that loaded swf from a button located inside the external swf itself. I've come up with codes that won't give errors but won't work either. One thing different in my case is that my main movie is a projector .exe file. I never thought it would be relevant but given the situation I'm starting to think it could be.
I'm loading the external swf with this code:
z5990_btn.addEventListener(MouseEvent.CLICK,loadCard);
function loadCard(event:MouseEvent) {
trace("you clicked me");
var loadit = new Loader();
addChild(loadit);
var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
loadit.load(new URLRequest("casas/Zurich5990.swf"), _lc);
}
Then trying to unload from a code attached to the close button inside external swf...
close_btn.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);
function fl_MouseClickHandler_2(event:MouseEvent):void
{
MovieClip(this.parent.parent).loadit.unloadAndStop;
}
This is at least the third method I've tried so if anyone could help me I would thank you a lot.
