Question
Preventing external swfs loaded into a movieclip image from stacking
So I've been building a webpage that contains 5 "content"
sections each loaded on their own swf files into a movieclip called
loader_mc when I click the corresponding button. So far, my code
works to load the swf's into a movieclip entitled loader_mc when I
click on the respective buttons but when I try to change sections,
that's where things unravel.
The "samples" section streams video, and when I leave the "samples" section, the audio is still streaming even if I'm looking at the "about" page (or any of the other for that matter). It seems as if my swf's just keep loading one on top of another (not what I want), where what I want to accomplish is to have the swf files replaced upon clicking a button with whatever swf is appropriate to the section I've just clicked. That way dynamic content doesn't sound or appear to be playing even when the user is supposed to have made it "go away". Below I've pasted the code that I think you'll all need to see in hopes you may be able to assist me in tweaking my code to get it to operate.
Here's where I defined my variables:
var contentLoader:Loader = new Loader();
var aboutURL:String = "z_about.swf";
var aboutRequest:URLRequest = new URLRequest(aboutURL);
var samplesURL:String = "z_samples.swf";
var samplesRequest:URLRequest = new URLRequest(samplesURL);
var contactURL:String = "z_contact.swf";
var contactRequest:URLRequest = new URLRequest(contactURL);
var linksURL:String = "z_links.swf";
var linksRequest:URLRequest = new URLRequest(linksURL);
var homeURL:String = "z_home.swf";
var homeRequest:URLRequest = new URLRequest(homeURL);
And here's an example of one of my buttons codes for the Click event:
function linksClick(event:MouseEvent):void
{
zMenu.links_words.gotoAndPlay("click");
contentLoader.load(linksRequest);
loader_mc.addChild(contentLoader);
}
Does anyone have any idea where I might have gone wrong? I've made it this far mostly through tutorials, but I think I'm in a little over my head at combining the things I've picked up without forgetting important elements. Any help is greatly appreciated.
The "samples" section streams video, and when I leave the "samples" section, the audio is still streaming even if I'm looking at the "about" page (or any of the other for that matter). It seems as if my swf's just keep loading one on top of another (not what I want), where what I want to accomplish is to have the swf files replaced upon clicking a button with whatever swf is appropriate to the section I've just clicked. That way dynamic content doesn't sound or appear to be playing even when the user is supposed to have made it "go away". Below I've pasted the code that I think you'll all need to see in hopes you may be able to assist me in tweaking my code to get it to operate.
Here's where I defined my variables:
var contentLoader:Loader = new Loader();
var aboutURL:String = "z_about.swf";
var aboutRequest:URLRequest = new URLRequest(aboutURL);
var samplesURL:String = "z_samples.swf";
var samplesRequest:URLRequest = new URLRequest(samplesURL);
var contactURL:String = "z_contact.swf";
var contactRequest:URLRequest = new URLRequest(contactURL);
var linksURL:String = "z_links.swf";
var linksRequest:URLRequest = new URLRequest(linksURL);
var homeURL:String = "z_home.swf";
var homeRequest:URLRequest = new URLRequest(homeURL);
And here's an example of one of my buttons codes for the Click event:
function linksClick(event:MouseEvent):void
{
zMenu.links_words.gotoAndPlay("click");
contentLoader.load(linksRequest);
loader_mc.addChild(contentLoader);
}
Does anyone have any idea where I might have gone wrong? I've made it this far mostly through tutorials, but I think I'm in a little over my head at combining the things I've picked up without forgetting important elements. Any help is greatly appreciated.