Skip to main content
Inspiring
August 18, 2006
Answered

Loading an external SWF from an external SWF

  • August 18, 2006
  • 10 replies
  • 2135 views
Hello,

I'm somewhat caught between a rock and a hard spot on a flash site project. Here is the situation:

I have created a parent movie (which loads all external SWFs inside of it) that has the menu navigation built into it. However, my client wants me to place some more links inside of the external SWFs that lead to other pages (external SWFs) of the site. Is this at all possible? I was hoping there is a way to tell a button in an external SWF to make the parent movie switch between external SWFs.

Any and ALL help is very much appreciated. Thank you.

Another question: does this involve using the _parent script?

Elijah
This topic has been closed for replies.
Correct answer kglad
if you want, for example, a button in welcome.swf to load a swf into holder, then welcome.swf will be unloaded. is that what you want? if so, in welcome.swf you can use:

10 replies

kglad
Community Expert
Community Expert
August 23, 2006
no, you don't need to use it if there's nothing on-stage causing a problem.

the code you just posted for b12 is, i thought, working. what code is not working?
August 23, 2006
Thanks. I found a solution by unloading the _level1 clips for each _level0 button on my external loader.
kglad
Community Expert
Community Expert
August 23, 2006
you're welcome.
kglad
Community Expert
Community Expert
August 23, 2006
do you use holder.unloadMovie() or anything similar?
August 23, 2006
Here is the code for one of the buttons:

b12.onRelease = function() {
_level0.loader._visible = true;
_level0.mcl.loadClip("SP_history.swf", 1);

I don't use holder.unloadMovie, or anything similar, anywhere... I'm guessing I should somewhere?

kglad
Community Expert
Community Expert
August 23, 2006
the code on button b11 is incorrect. you should use either loadMovie() or loadClip to load Meet_staff.swf but not both.

because you want to use your preloader that's tied to your moviecliploader use the loadClip() statement only.

your code on b12 is also problematic. in your latest message there's no target movieclip/level for your loadClip statement and in the message previous to that you were loading into _level1 (with your loadClip statement) and into holder with your loadMovie() statement.

again, eliminate your loadMovie() statement. and use a target (holder or _level1 are both ok) for your loadClip() statement.
August 23, 2006
It works great now! Thanks for the support. I've used _level1 as my target and have lost all functionality of my _level0 buttons that are on my main external loader. How would I go about solving this issue? Again, thanks in advance and hopefully I won't be asking so many questions that much longer....

Thanks,
Aaron
kglad
Community Expert
Community Expert
August 23, 2006
why are you loading the same swf into two different targets (holder and _level1)?
August 23, 2006
It's been the only way I can get the externally loaded swfs to appear in the holder and load in the same fashion as those that are linked on the _level0 external loader. For instance, if I put:

b11.onRelease = function() {
this._parent.loadMovie("Meet_staff.swf", holder);
_level0.loader._visible = true;
_level0.mcl.loadClip("Meet_staff.swf", holder);
};

then all I can see after clicking the external swf button is a partially loaded 'loader' screen

If I put this:

b12.onRelease = function() {
this._parent.loadMovie("SP_history.swf", holder);
_level0.loader._visible = true;
_level0.mcl.loadClip("SP_history.swf");
};

Then the external loader doesn't show up at all and I'm looking at an exernal.swf just sitting there by itself. Just to let you know, my exteral loader code on _level0 is the same as Icemans. Thanks for your help.
kglad
Community Expert
Community Expert
August 22, 2006
aaron, if there are pages not downloading entirely it's usually because you're swf is doing something (that assumes downloading is complete) before the download is complete.

for example, you may be trying to advance the playhead to a movieclip's frame when that frame is not completely loaded. the remedy, is to wait until loading is complete before using anything that's loaded into your swf, including xml files, text files, jpgs/gifs, mp3s and swfs.

as for a black flash, is that a momentary issue? if so, that's usually remedied by making the target movieclip's _alpha property 0 while loading the external swf (or graphic) and re-setting to 100 when loading is complete and you want your object to be visible.

p.s. all loaded objects must be loaded into some kind of holder so if you're loading a swf, you must be loading into a target movieclip or _level.
August 22, 2006
So, I've had some time this evening and hav figured out how to link externally loaded swfs to another external swf, thanks to kglad. Now, my main timeline links don't work once I have loaded an externally linked swf. any reason why this would be?

Thanks in advance.
kglad
Community Expert
Community Expert
August 23, 2006
show the code that's not working and, if it only fails after other code is executed, show the other code, too.
kglad
Community Expert
Community Expert
August 20, 2006
you're welcome.
August 20, 2006
Works like a charm. Now I need to figure out how script a preloader for each of those pages. Would the code be the same as it would for a normal preloader, or whould there be addtional code because of the parent?
Inspiring
August 20, 2006
Hey Aaron,

Actually, I'm still trying to figure that part out too. In my "index.swf" file (see above for the explanation of my file structure) the "holder" mc (which displays the external swf files) has a "loader" that is visible when loading a swf and not visible when a swf is loaded. However, now that I have set up a button to open up another external swf from another external swf inside of "index.swf" (the parent swf), the button opens the other swf file up just fine, but the "loader" does not show up when it's loading.

Kglad, do you know what we should do to fix this? Thanks again for all your help.

Elijah
August 19, 2006
Yes, my assumption is that it's not possible.

Here's the skinny on my flash site. I've created an external loader to load each of my main pages. "The_studio.swf" is one of pages loaded by a button on the external loader. I have buttons on "The_studio.swf" as well and would like to link them so that when their button instance is clicked, it will load that particular page with the same view as "The_studio.swf"...
kglad
Community Expert
Community Expert
August 19, 2006
that can be done. but The_studio.swf will be unloaded (along with b11). that's not a problem unless it's not what you intend.

if it is what you want and b11 is a true button (not a movieclip button) and b11 is on the main timeline of The_studio.swf, you can use:

August 19, 2006
You rock. Thanks for all of the prompt responses. I'll give this a whirl and check back in with the results.

Thanks again,
Aaron
kglad
Community Expert
Community Expert
August 19, 2006
you want to load into the same target movieclip into which The_studio.swf was loaded? and the button (b11) that's doing this loading is in The_studio.swf?
kglad
Community Expert
Community Expert
August 19, 2006
you're welcome.
kglad
Community Expert
Community Expert
August 19, 2006
yes, your loaded swfs can load other swfs. how you should code that depends upon where you want the code to reside and where the target movieclip is located (unless you load into a _level).
Inspiring
August 19, 2006
Hello,

Thank you for replying. Here is exactly what I'm needing to do:

We will call the parent file "index.swf". Inside "index.swf" I have a "holder" for external swf files to load into when I call on them from the main menu buttons on "index.swf". When a customer comes to the site, the "index.swf" file initially loads "welcome.swf". Inside of "welcome.swf", I have some images that I want to make into links to other external swf files.

My problem is when someone clicks on one of those pictures I want the "index.swf" file to open up the corresponding external swf file in its "holder", where "welcome.swf" currently resides. Also, all of these swf files ("index.swf" included) have stand-alone FLA files, none are attached to one another. I have never worked with "levels" before, would that be necessary in this case? I have attached the code for the external swf loader.

I hope that gives you a better idea of what I'm trying to accomplish.

Thanks again.

Elijah

CODE:
kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
August 19, 2006
if you want, for example, a button in welcome.swf to load a swf into holder, then welcome.swf will be unloaded. is that what you want? if so, in welcome.swf you can use: