Having some problems with preloaders on a website

i’m building a pretty large website totally using flash. The button animations and action scripts are all pretty basic though. when i test the site out on my harddrive, with only one scene (the main index page) that then imports other flash swf’s for the other sections of the website, it all works fine. there are three layers in this scene, navigation (where the buttons are) actions (where the scripts are) and background. the background consists of a looping animation (18 frames long) that is suppossed to play in the background forever. it works okay, with the other sections (external swf’s) loading on top of it fine, and then disappearing when I use the back button.

however, when i tack on another scene with a basic preloader (percentage bar) before that main index scene and then test it, it seems fine, but when you click on a button and it imports the external swf, it only stays up for a few seconds. it’s like because the main index scene has the looping animation, everytime it reaches back to frame 1 it resets the buttons.

the problem makes some sense to me, but what i don’t understand is why it doesn’t seem to care about the loop when it’s just one scene, but when i add the preloader scene ahead of it, it starts acting screwy.

the preloader is two frames long and is really nothing more than a percentage bar loading.

the code for the preloader (frame 1) is this:

bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*438;
if (bytes_loaded == bytes_total) {

frame 2 is:


an example of the basic button’s actionscript is:

on (release) {

if anyone has any suggestions, i would great appreciate them, especially since i also plan to have preloaders before the individual sections (external swf’s) that will be loading on top of this main index swf.

thanks alot.

john hill

I’m not entirely sure why that is happening to you, but it doesn’t sound uncommon. Scenes always cause trouble for me.

My suggestion would be to spend a couple of days using the search feature to look for any posts in these forum on the subject of “preloaders”. You will probebly find that the solutions we have worked on already will illiminate the need for you to use a preloader on your main timeline at all. Likewise, scenes should become unnecessary as well.

I use a preloader movie clip which is fed information from functions. This information consists of what is being loaded and what it is being loaded into. Once you have that information dynamicaly loaded into your preloader upon request, you can preload anything with the same object over and over again.

That will probebly make more sense if you take my suggestion and look at some of the previous posts on preloaders.

no, the preloader works. i can put it in a scene before the main index scene, or i can just put it in the first two frames of the main index scene, either way the preloader always works correctly.

what isn’t working correctly is the button functions and the looping animation of the website. the buttons bring up the external swf’s, but they disappear when the looping background hits the first frame of it’s loop again.

the only thing about the preloader is that the site, all it’s button functions and looping animation worked great before i plugged the preloader into it. it’s like the two action scripts are messing one another up or something.

i have a feeling it might have something to do with the _root command that i’m using for the navigation of the flash site. perhaps since there is more to it than just a simple loop (since i have preloader now) _root isn’t sufficient?

I just meant that the preloader function of goto commands may be acting funny because you’re using scenes. But you’re right… if it works in both places, but causes the same glitch it’s something else.

looking at the code though… I can’t find anything wrong with it.

you sure you remembered stop actions at the end of the scene that you’re going to? That will make it loop back to frame 1 as well.

this morning it dawned on me that i need the stop action. i had thought about putting one in, but i hadn’t, and without it (the stop command), without the preloader, it was working regardless.

however, when i attatched that preloader, it suddenly got wise and i guess flash noticed i didn’t have one.

so i guess the real fluke was that it didn’t really care if i had one or not without the preloader.

oh well, thanks alot though.