PDA

View Full Version : Flash Preloader Help?


Artboycat
1-25-06, 11:29 PM
Hi, I'm working alot more in flash now and I've designed most of my site as well as others with Flash....I finally figured out how to make a decent preloader that works but their are still somethings I am unaware of...The loader i created based on an online tutorial loads the page that needs to but what i realized is that when the flash page is active on a site it only loads the first frame and then the page stops to load the rest of the frames after the preloader has loaded the first frame....this is the code I am using

myLoaded = Math.round(getBytesLoaded());
myTotal = Math.round(getBytesTotal());
myPercent = myLoaded/myTotal;
myBar._width = myPercent*150;
myText = Math.round(myPercent*100)+"%";
if (myLoaded == myTotal) {
gotoAndStop(3);
} else {
gotoAndPlay(1);
}

ideally I would like to make sure that the preloader reads all the frames before loading the page or site...Can anybody help me with this or maybe give me guidelines on how to set up a preloader in a flash movie with multiple scenes, a website with various movies that load within the main page of the site, or just a whole site where the various pages are structured within seperate scenes in the movie....if anybody understands and can help me with this I would greatly appreciate it!!

oatesj77
1-26-06, 05:13 AM
try changinf your if/else statement to:

ifFrameLoaded (100) {
gotoAndPlay(3);
}

just put in the last frame number, then it will wait until it is completely loaded, or you can use a lower frame to start while the rest is loading.

as for scenes, try to just think of them as extensions, when flash compiles a swf, everything is flattened into one timeline so you would 1-100 then A-1-100 then B-1-100. you can't think of scenes as you would another swf, in fact it is a better practice to eliminate using scenes overall and just use one timeline.

hope that helps some

BerksWebGuy
1-26-06, 09:22 AM
If you are using seperate scenes, make a preload scene and put this in there ('movie' being the scene you want preloaded):

ifFrameLoaded ("movie", 1) {
nextScene();
}

Artboycat
1-26-06, 11:54 AM
try changinf your if/else statement to:

ifFrameLoaded (100) {
gotoAndPlay(3);
}

just put in the last frame number, then it will wait until it is completely loaded, or you can use a lower frame to start while the rest is loading.

as for scenes, try to just think of them as extensions, when flash compiles a swf, everything is flattened into one timeline so you would 1-100 then A-1-100 then B-1-100. you can't think of scenes as you would another swf, in fact it is a better practice to eliminate using scenes overall and just use one timeline.

hope that helps some

i tried the code but when i test it out the load bar just stays the same and does not move or show the percentage on the bottom....but this gives me a good idea of what i should be doing...thnks...
I'm kind of afraid to use one time line for everything because i think it would become to cluttered and confusing for me, especially if I'm creating a site or something....right now the way i have it mapped out is that each link loads a new swf into the existing movie or scene and each scene has its own preloader to load that single scene onto the main page....however I would like to be able to create one whole movie/site that preloads every scene before loading and all teh scenes are linked together by go to and play rather then load movie...but I guess this would only be useful if the site is really simple and small....The preloader im using seems to be able to do that but I haven't fully tested it yet to see if it works the way i think it would or should

Artboycat
1-26-06, 11:55 AM
If you are using seperate scenes, make a preload scene and put this in there ('movie' being the scene you want preloaded):

ifFrameLoaded ("movie", 1) {
nextScene();
}


thanks