I have tried several suggestions on this forum to resolve my issue, but it is obvious to me I am missing something because I am a NOVICE Flash developer. I have everything working in my Flash file EXCEPT I want to use this code to play a .swf file. When the swf file is done playing OR the user clicks the “Return to Main Menu button”, they return to frame 1.
var fl_ToLoad_7:Boolean = true;
fl_Loader_7 = new Loader();
fl_Loader_7 .x = 19;
fl_Loader_7 .y = 67;
fl_Loader_7 = null;
// Toggle whether you want to load or unload the SWF
fl_ToLoad_7 = !fl_ToLoad_7;
The .swf file plays and when I click “Return to the Main Menu” button, only certain items display from frame 1. The .swf file is still loaded hiding the items that should display on frame 1. I have attached a screen shot of what happens when I click the "Return to Main Menu" button.
Here is a screen shot of what frame 1 should look like.
I am on a very tight deadline so any assistance would be most appreciated!
When you dynamically add content to a timeline, it does not have a home in any frame of that timeline - so it will persist wherever else you go in that timeline unless you remove it (or anchor it to something that is bound to a frame such as an empty movieclip that you place there).
Try unloading the swf before you go to another frame...
I have been able to figure out how to get back to frame 1 from the .swf file. Here is the code I used:
fl_Loader_14 = null;
Now I can't get the swf to stop playing. Can anybody help with that?
Thanks for that information, it was exactly what I needed. Now I have one more issue, my Flash files works perfectly when testing in Flash. When I put it on our webserver, the main .swf file opens just fine, but none of my .swf files play when I select it from the main .swf file. I have all of my .swf files in the same location since that is how I coded the Flash file and I have tried a couple of things to make it work to no success. Any ideas?
If the main swf file is not in the same folder as the html page that embeds it, then you needs to adjust how it targets any files it loads. The html page dictates the targeting reference for anything that it contains, so the swf has to target files as if it is in the same folder as the html page ... it doesn't have to be in that folder, it just has to act like it is.
Thanks for the help, but I did have all of the .swf files in the same folder. That turned out to be the problem, the swf files needed to be in a different location than the main .swf file. I can't explain why that is the case, but as long as it works (which it does) I am happy.
That should not be necessary. You might need to reread what I wote. The location needs are driven by the html page that you load the main swf into.
If you embed the main file using something like...
meaning the html page is in a different folder than the main file, and your other swf's are in the same folder as the main, then your main file will also have to target the files it loads using...
because when it is embedded in the html page, it is as good as living in its folder.
Europe, Middle East and Africa