# Fade out a preloader

**URL:** https://forum.kirupa.com/t/fade-out-a-preloader/69506
**Category:** flash
**Created:** [November 4, 2004, 10:07pm UTC](https://forum.kirupa.com/t/fade-out-a-preloader/69506 "2004-11-04T22:07:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dru\_nasty](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dru\_nasty](https://forum.kirupa.com/u/dru_nasty)
#### Post date: [November 4, 2004, 10:07pm UTC](https://forum.kirupa.com/t/fade-out-a-preloader/69506/1 "2004-11-04T22:07:42Z")

</div>

I’m over here putting together a tweened preloader that runs in time with bytes loaded. I’m just wondering how I could make the preloader movieclip fade out when the tween is finished and then advance the playhead when the alpha reaches 0. I can post an fla if that’ll help anyone understand better.  
Heres the code on the preloader movieclip:

```auto

onClipEvent (load) {
        if (_parent.getBytesTotal() == _parent.getBytesLoaded()) {
                quickPlay = true;
        } else {
                preLoad = (_parent.getBytesTotal() * 0.75); //percent to preload
        }
        _parent.stop();
}

onClipEvent (enterFrame) {
        gotoAndStop(loadedIndicatorFrame());
        if (quickPlay == true) { //quickly play the anim
                if (_currentframe == _totalframes) {
                        _parent.play();
                }
        } else { //wait for the preload
                if (_parent.getBytesLoaded() >= preLoad) {
                        _parent.play();
                }
        }
}

```

Then this is on the main timeline in the preloader mc:

```auto

lastFrame = 1;

function loadedIndicatorFrame() {
        var newFrame = int((_parent.getBytesLoaded() / _parent.getBytesTotal()) * 65) + 2;
        if (newFrame - lastFrame > 4) { //too far
                lastFrame += 4;
                loadedText = int(_parent.getBytesTotal() / 1024 * (lastFrame - 2) / 65) + "kb of " + int(_parent.getBytesTotal() / 1024) + "kb";
        } else if (newFrame - lastFrame > 0) { //normal move
                lastFrame++;
                loadedText = int(_parent.getBytesLoaded() / 1024) + "kb of " + int(_parent.getBytesTotal() / 1024) + "kb";
        }
        return lastFrame;
}

```

I’m guessing its just a simple script in the (enterFrame). Thanks for any help. 😃
