bdq172
02-15-2008, 04:21 PM
I'm using a parent swf to load child swf's. I have next and previous buttons to load the child swf's. If I skip over a swf by using the next button the audio of the skipped over swf starts to play momentarily. How do I unload any sounds so they don't play over the next swf?
//This is the code I'm using in the parent swf to load the child swf's.
Btn_Next.addEventListener(MouseEvent.CLICK, NextSubmit);
//nextlarge.addEventListener(MouseEvent.CLICK, NextSubmit);
smallnext.addEventListener(MouseEvent.CLICK, NextSubmit);
function NextSubmit(event:MouseEvent) {
//I put this code in to unload
smartGraphicLoader.unload();
if(IntroPresent > 0) {
//Change the value of the IntroPresent variable
//so that it indicates that the introduction is absent
IntroPresent = 0;
CurrentTopic = 1;
CurrentSlide = 0;
}
CurrentSlide++;
var SlideMax:int = lessonInfoXML.topic[CurrentTopic - 1].slide.length();
if (CurrentSlide < SlideMax + 1) {
nextGraphicFile = lessonInfoXML.topic[CurrentTopic - 1].slide[CurrentSlide - 1].graphic;
//if the slide does not belong to a series of slides, change the graphic.
//(Graphic of selected slide not the same as currently displayed graphic)
if(nextGraphicFile != smartGraphicFile) {
smartGraphicFile = nextGraphicFile;
smartGraphicFileReq = new URLRequest(smartGraphicFile);
smartGraphicLoader.load(smartGraphicFileReq);
addChild(smartGraphicLoader);
}
//This is the code I put into the child swf to listen for the unload event in the//parent swf.
function closeAllStreams(evt:Event) {
ani_mon.theVideo.ns.close();
ani_mon.theVideo.nc.close();
ani_mon.theVideo.minuteTimer6.stop();
}
ani_mon.theVideo.loaderInfo.addEventListener(Event .UNLOAD, closeAllStreams);
//This is the code I'm using in the parent swf to load the child swf's.
Btn_Next.addEventListener(MouseEvent.CLICK, NextSubmit);
//nextlarge.addEventListener(MouseEvent.CLICK, NextSubmit);
smallnext.addEventListener(MouseEvent.CLICK, NextSubmit);
function NextSubmit(event:MouseEvent) {
//I put this code in to unload
smartGraphicLoader.unload();
if(IntroPresent > 0) {
//Change the value of the IntroPresent variable
//so that it indicates that the introduction is absent
IntroPresent = 0;
CurrentTopic = 1;
CurrentSlide = 0;
}
CurrentSlide++;
var SlideMax:int = lessonInfoXML.topic[CurrentTopic - 1].slide.length();
if (CurrentSlide < SlideMax + 1) {
nextGraphicFile = lessonInfoXML.topic[CurrentTopic - 1].slide[CurrentSlide - 1].graphic;
//if the slide does not belong to a series of slides, change the graphic.
//(Graphic of selected slide not the same as currently displayed graphic)
if(nextGraphicFile != smartGraphicFile) {
smartGraphicFile = nextGraphicFile;
smartGraphicFileReq = new URLRequest(smartGraphicFile);
smartGraphicLoader.load(smartGraphicFileReq);
addChild(smartGraphicLoader);
}
//This is the code I put into the child swf to listen for the unload event in the//parent swf.
function closeAllStreams(evt:Event) {
ani_mon.theVideo.ns.close();
ani_mon.theVideo.nc.close();
ani_mon.theVideo.minuteTimer6.stop();
}
ani_mon.theVideo.loaderInfo.addEventListener(Event .UNLOAD, closeAllStreams);