Advanced Preloader Play Control

Ok I have two scenes setup where the first scene has a preloader that works great - here is the catchy part though - my first scene (where the code is) is 140 frames long and the second scene is over 400 frames - once all of the frames have been loaded from the second scene the first scene JUMPS to and plays frame 1 of the second scene, reguardless of where the playhead is in the first scene - what I want it to do is once the second scene has been loaded I want the first scene to play all the way to the end (frame 140, scene 1) of the first scene and THEN going on to the second scene (frame 1, scene 2)giving my sound and animation a smooth transition over - any help would greatly be appreciated - thanks!

frost

In your code you’ll probably have a gotoAndPlay (“Scene”, number) once it’s done preloading - depending on what type of preloader you’re using.

In the last frame of Scene 1 - 140 have a variable, like done, set to 1 or true.

Then in your preloader, add

if (loaded_bytes == total_bytes && done) {
gotoAndPlay (“Scene2”, 1)
}

whatever it is you use, just check to see if done == true then jump to the next scene, this way the preloader will only go once you’ve reached the frame 140 and done is set to true.

Nice - what variable would you put on frame 140 though? and what exactly would it do? Thanks

frost

on the last frame 140 put:

done = 1;

and in your preloader check, put what I posted before:

if (loaded_bytes == total_bytes && done) {
gotoAndPlay (“Scene2”, 1)
}

change the loaded_bytes bit to whatever check you use.

done = 1 means done is true

the && done bit just means and when done = 1 or true.

here, lemme add a little noobness to this…

how do you make a preloader?
are they extremely neccesary, or only useful when u have large graphics/animations/sounds to load?

how do they work?

hey i tried that code and it made the transition from scene 1 to scene 2 seem even more choppy, and then for some odd reason in the second scene it locks in the middle of the movie - after like 15 seconds it continues from where it left off - what I have been using as a preloader is this on the first frame of scene one…

if (_framesloaded>=_totalframes) {
gotoAndPlay(“main intro”, 1);
} else {
gotoAndPlay(“preloader”, 1);
}

and then on the last frame of scene one this code…

gotoAndPlay(1);

this seems to give me a smoother transition over - by reviewing the movie in the bandwidth profiler it does infact load 100% until the movie goes onto scene 2 - then again I might be putting something in wrong with the code you gave me -

frost

any idea why it would cause the movie to freeze in the second scene?

There’s no reason it should freeze in the second scene, unless you have a stop somewhere, or, use gotoAndStop, or you preloader isn’t preloading properly - ie. you didn’t put the variable in the right place.

if (_framesloaded>=_totalframes && done) {
gotoAndPlay(“main intro”, 1);
} else {
gotoAndPlay(“preloader”, 1);
}

should work fine - I’ve used it and recommended to others with perfect results. Hard to know without seeing your code or fla.

Also name your scenes like mainIntro instead of main intro. Has been known to cause problems for some people.

man I hate to keep asking questions, but now with the code you gave me it just sits there looping over and over in the first scene and wont go onto the next scene -

frost

I also renamed “main intro” to “mainintro”

ok you know what it works fine - there was a layer that wasnt visible with some code on it that was messing up everything - thanks for your help -

frost