Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whats the simple preloader stinkin code?!! 1

Status
Not open for further replies.

Firehawk734

Technical User
Jan 22, 2002
155
US
I cant believe this, but i forgot how to do the most simple preloader.

I have 2 scenes, one called PRELOADER and the other called MAIN.

In the preloader scene, i have an animation sitting on the first frame, and a layer for actions under it. In the first actions frame, I need to code to put in there just to tell the program to load in my "main" scene, and then when its done, to continue to the main scene.

UGH!
 
Frame 1:

if(_root.getBytesLoaded() >= _root.getBytesTotal()){
gotoAndPlay("main",1);
}

Frame 2:

if(_root.getBytesLoaded() >= _root.getBytesTotal()){
gotoAndPlay("main",1);
}

Frame 3:

gotoAndPlay(2);


The first frame is only to prevent seeing a flash frame of the preloader upon a refresh or a subsequent visit to your site when the movie is cached, after the initial download.
This frame should remain clear of any displays. Thus make sure your movie clip on the other layer, is only over frames 2 & 3. Regards,

oldman3.gif
 
So all this goes into the preloader scene???

I dont get why in the third frame, it says gotoandplay(2)?

Isnt that going to go back to the second frame in the preloader??? And create a loop? or what?
 
That's the main idea in the proposed preloader!
Create a loop that checks if all the bytes of the movie are loaded, and play it if they are. Otherwise loop back to the checking script (frame 2) until they are!

And yes! ALL THOSE 3 FRAMES go into the preloader scene! Regards,

oldman3.gif
 
I am doing , show streaming, and its preloading but it seems to stay in the "preload" mode. Its not going on to the main scene.
 
What's your exact code?

What's the EXACT name of your main scene? Regards,

oldman3.gif
 
its working man, i didnt wait long enough, underestimated the size of my main scene.

Thanks alot. Just explain to me why the gotoandplay(2) is there telling it to go back because to me it seems indefinite.
 
LOL i just read your reason ugh thx sorry, million things going on.
 
i think you could also use the function

ifFrameLoaded (last frame of the last scene) {
gotoAndPlay(first frame of the first scene);
}

and put it in the last frame of your preloader scene which should be running in a loop.
the problem is that that way you won't be able to display the overall progress of loading.
that's the simplest preloader i know.

best regards

firegambler
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top