Hi. I have a button that loads an external swf.
this is the code
map_btn.addEventListener(MouseEvent.CLICK, clickFunction);
function clickFunction(evt:MouseEvent):void {
tint_mc.gotoAndPlay("on");
var request:URLRequest = new URLRequest("SWFS/map.swf");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);
}
Now i want that same button to unload that swf-file.
How?
I tried removeChild, but then this error appears:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at menu_fla::MainTimeline/clickFunction2()