...

View Full Version : Flash - Problem with external .swf loader



Hawkmoon
08-17-2004, 04:40 AM
I have a "loader" movieclip that works great at the beginning of a flash file (see code below) but when I import the published .swf into a parent flash file it only shows up as a blank screen while it loads. Then, once the external .swf is fully loaded, the "loader" appears for a brief second and then the movieclip plays.

I need to get it so the loader inside the external .swf shows up while the .swf is being loaded into the parent file.

Any help is GREATLY appreciated!




lBytes = _root.getBytesLoaded();
tBytes = _root.getBytesTotal();
percentLoaded = Math.floor((lBytes/tBytes)*100);
loader.bar._xscale = percentLoaded;
loader.percent.text = percentLoaded + "% of " + Math.floor(tBytes/1024) + "K loaded.";
if (lBytes>=tBytes && tBytes>0) {
if (count>=12) {
gotoAndStop("intro");
} else {
count++;
gotoAndPlay("preload");
}
} else {
gotoAndPlay("preload");
}

jamescover
08-17-2004, 04:57 AM
Just a few questions for clarification:


lBytes = _root.getBytesLoaded();

I take it, you're trying to preload the main movie???


loader.bar._xscale = percentLoaded;

Shouldn't this be:

_root.loader.bar._xscale = etc.


if (count>=12)

where is the initial value of count set? In frame 1 of loader MC?


gotoAndStop("intro");
gotoAndPlay("preload");

Are these frame labels on the main timeline. If so, this should read:

_root.gotoAndStop("intro"), etc.


-james

Hawkmoon
08-17-2004, 05:11 AM
Thanks James for the quick response! Here are the answers to your questions:

1. Correct
2. "Loader" is a movieclip in the main movie, so it still works, but good point.
3. Count is obsolete...that's legacy code so the following could be reduced to gotoAndStop("intro");


if (count>=12) {
gotoAndStop("intro");
} else {
count++;
gotoAndPlay("preload");
}

4. Again, because they are labels in the main movie, it still works, but you're right - that's better coding.

This code works fine as a loader for a single .swf. The bigger issue is that it doesn't work as a loader when the publised .swf is imported into a parent .swf

Basically I just need code (this code or anything else) that shows a "loading..." screen for an imported .swf. Right now flash loads the external .swf and then runs the "loading..." screen for half a second. But that doesn't help because the user has had to wait 10-20 seconds for the external .swf to load.

Thanks again for the help!

PS. I like the footnote below your name ;)

jamescover
08-18-2004, 07:55 AM
Thanks James for the quick response! Here are the answers to your questions:

Sorry, for taking so long to respond. I'm busy with a db project, and I thought/hoped someone else would chime in after you clarified a few things.

Unfortunately, I'm afraid I'm still not following what you are trying to accomplish, or the hierarchy of your movie. I thought you were preloading the main movie, but I don't understand why you would (apparently) load the preloader movie as an external swf. If this is, in fact, what you are doing, I suggest recreating it as an MC or Scene (if you prefer) in the main movie.


PS. I like the footnote below your name

That's good news, indeed!



-james



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum