Preloader

for my flash site i just have a normal bar loader with amount etc how do I make a loader with a animation its never sank in really how to do it

-Tom

Easy way:

If your animation is 30 frames long, in frame 30 put:


if (_framesloaded >= _totalframes) {
gotoAndPlay (wherever);
} else {
gotoAndPlay(1);
}

This should play your animation and if by the time it’s finished, the movie has loaded, it will go to where you want, else back to frame 1 again.

You could also use getBytesLoaded() and getBytesTotal() to do this.

EDIT: Or did you want to know how to do both - preload with the bar - and an animation at the same time - then play when both finish…

cheers thats wot i wanted so do i just put the loader animation in and just move the actual site over however many frames

-Tom

You can do that or have two scenes. Have animation from 1 -20, and the main content start at 21 (with a frame label “main” or something) and have the preloder code in frame 20, or have it on another scene. 1st scene preloader, 2nd scene actual content.

if (_framesloaded >= _totalframes) {
gotoAndPlay ("Scenename", "1"); // I think even nextScene(); should work
} else {
gotoAndPlay(1);
}

or if animation is 30 frames long, on frame 31, put:

if (_framesloaded >= _totalframes) {
gotoAndPlay (32);
} else {
gotoAndPlay(1);
}

This is if your content is on frame 32.

Also try and use frame labels instead of numbers, as if you shift, add or insert frames, you won’t have to go around changing the numbers.