# Preloader

**URL:** <https://forum.kirupa.com/t/preloader/6151>\
**Category:** Uncategorized\
**Created:** [September 30, 2002, 7:44pm UTC](https://forum.kirupa.com/t/preloader/6151 "2002-09-30T19:44:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![novatake](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@novatake](https://forum.kirupa.com/u/novatake)\
**Post date:** [September 30, 2002, 7:44pm UTC](https://forum.kirupa.com/t/preloader/6151/1 "2002-09-30T19:44:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 30, 2002, 8:15pm UTC](https://forum.kirupa.com/t/preloader/6151/2 "2002-09-30T20:15:47Z")

</div>

Easy way:

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

```php

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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 2, 2002, 7:33pm UTC](https://forum.kirupa.com/t/preloader/6151/3 "2002-10-02T19:33:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 2, 2002, 7:45pm UTC](https://forum.kirupa.com/t/preloader/6151/4 "2002-10-02T19:45:06Z")

</div>

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.

```php
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:

```php
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.
