Copy link to clipboard
Copied
Hi there i have made a navigation in flash and 3 buttons that load some external swf's. Problem is that when they load the parent swf keeps playing in the background. How can i make them play separately and make the navigation stage dissapear completely when they load?
Copy link to clipboard
Copied
It depends on how your file is designed. It might be possible to have all the main content that is not involved with the loaded content in a movieclip where you control the visibility of it.
Copy link to clipboard
Copied
Unfortunately i cannot do that because its not like some buttons in a webpage it has a background image some huge buttons etc. I want the external swf to start fresh
Copy link to clipboard
Copied
Nothing that you just described would forego being abble to place it in a movieclip.... If it is occupying your main timeline, it can occupy a movieclip's timeline just as easily.
What you cannot do is remove a parent object and expect the children of it to stick around... they are removed with it
Copy link to clipboard
Copied
My code right now for loading the external swf is this :
Quizbtn.addEventListener(MouseEvent.CLICK, quizFunc);
function quizFunc(curEvt:MouseEvent) {
var myLoader:Loader = new Loader(); // create a new instance of the Loader class
var url:URLRequest = new URLRequest("quiz.swf"); // in this case both SWFs are in the same folder
myLoader.load(url); // load the SWF file
addChild(myLoader);
}
Instead of adding them as children can i make them parents or something that can achive to play exactly on their own?
Copy link to clipboard
Copied
It is not clear to me what you are trying to accomplish as far as removing things goes. You cannot make a Loader part of your file without making it a child of your file. If you want the loaded file to take over the whole file, then you need the rest of the file to have been loaded by the very same Loader... that way it would be replaced when you load something else into the Loader.
If you want other content to not be visible, one other way to accomplish that is to have a large area (a rectangular shape) that you use as a blocker to hide the other content. First you can addChild(blocker) to hide everything, then you can addChild(loader) to place the loader on top of the blocker. That way the blocker blocks everything except the loader.
Copy link to clipboard
Copied
This is quite frustrating i see your point but is there any simple and normal way to this? All i want is when i click on a button to load an external swf all the previous staff on the page to unload, dissapear and the loaded swf to take place. Thats what i cannot understand how to do
Copy link to clipboard
Copied
I have already told you the easiest ways I can think of to do what you seem to want to do. If you haven't attempted any of them beyond thinking they can't work then there isn't much else I can offer.
Copy link to clipboard
Copied
I have attempted to use the same Loader but it doesnt replace it i dont know why.
var myLoader:Loader = new Loader();
var myLoaderMain:URLRequest = new URLRequest("main1.swf");
var myLoaderQuiz:URLRequest = new URLRequest("quiz.swf");
var myLoaderAnimation:URLRequest = new URLRequest("athens_animation.swf");
var myLoaderVideo:URLRequest = new URLRequest("videogallery.swf");
videogallerybtn.addEventListener(MouseEvent.CLICK, videoFunc);
function videoFunc(curEvt:MouseEvent) {
myLoader.load(myLoaderVideo);
addChild(myLoader);
}
Quizbtn.addEventListener(MouseEvent.CLICK, quizFunc);
function quizFunc(curEvt:MouseEvent) {
myLoader.load(myLoaderQuiz);
addChild(myLoader);
}
Animationbtn.addEventListener(MouseEvent.CLICK, AnimationFunc);
function AnimationFunc(curEvt:MouseEvent) {
myLoader.load(myLoaderAnimation);
addChild(myLoader);
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now