Unload and Stop swf from stage
Hi,
I'm a newbie to Flash and Actionscript. I need to give links to around 20 swf files via buttons from the menu.swf. I'm able to give links. But when I come back by clicking HOME button kept at the newly loaded swf the audio files are still being played at the background.
Yes, It has got audio files playing at the back for each slide in the new swfs. When Click on the same link again in menu.swf again the files are being played with the unfinished old file. It's really hectic.
I need to unload it completely from stage when I come back to menu.swf by clicking on HOME button from any of 20 categories.
I used unloadAndStop but it is not doing. I hope that I'm commiting mistakes at somewhere but couldn't predict.
Need some help !
FOR HOME BUTTON:
var _content:Loader = new Loader();
function loadContent(content:String):void {
if (_content != null) {
_content.unloadAndStop(true);
removeChild(_content);
_content = null;
}
var loader:Loader = new Loader();
loader.load(new URLRequest(content)); //---->>>> I don't really know what should be put in this 😞
_content = addChild(loader) as Loader;
}
Home_Button.addEventListener(MouseEvent.CLICK, home);
function home(event:MouseEvent) {
_content.unloadAndStop(true);
var homeSWF:URLRequest = new URLRequest("demo.swf");
_content.load(homeSWF);
addChild(_content);
}
FOR MENU.swf button
var loader:Loader = new Loader();
Category1_Button.addEventListener(MouseEvent.CLICK, category1);
function category1(event:MouseEvent):void {
var Category1SWF:URLRequest = new URLRequest("Category1.swf");
loader.load(Category1SWF);
addChild(loader);
}
