# Movieclip preloader?

**URL:** <https://forum.kirupa.com/t/movieclip-preloader/185438>\
**Category:** flash\
**Created:** [April 13, 2006, 11:44am UTC](https://forum.kirupa.com/t/movieclip-preloader/185438 "2006-04-13T11:44:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![o111](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/o111/32/2123_2.png) [@o111](https://forum.kirupa.com/u/o111)\
**Post date:** [April 13, 2006, 11:44am UTC](https://forum.kirupa.com/t/movieclip-preloader/185438/1 "2006-04-13T11:44:46Z")

</div>

I read something about this in a tread, but didn’t get any further.  
Is it possible to create a movieclip, lets say it contains 10 frames of some animation. And put it on the main timeline and add some code to it that makes the movieclip-animation work as a preloader? So the animation starts on frame 1 and plays frame by frame until the stuff is loaded. (so it stops on frame 10)

Hope you understand this one:)  
Cheers!

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 13, 2006, 12:29pm UTC](https://forum.kirupa.com/t/movieclip-preloader/185438/2 "2006-04-13T12:29:24Z")

</div>

yes its very possible…

assuiming you have a clip with 10 frames to show the progress use the standard preloader code to set a variable “barlevel” inside an onEnterFrame

```auto

this.onEnterFrame = function() {
    //
    barlevel = Math.floor(movieClip.getBytesLoaded()/movieClip.getBytesTotal())*100;
    //
    if (barlevel>0) {
        clipToAnimate.gotoAndStop(Math.round(barlevel/10));
    } else {
        clipToAnimate.gotoAndStop(1);
    }
};

```

---

<div class="post-metadata">

**Author:** ![o111](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/o111/32/2123_2.png) [@o111](https://forum.kirupa.com/u/o111)\
**Post date:** [April 13, 2006, 2:27pm UTC](https://forum.kirupa.com/t/movieclip-preloader/185438/3 "2006-04-13T14:27:52Z")

</div>

Umm okey! thank you:)  
but more detailed, what do I do?^^

In frame 1 (main timeline) I have the preloader.  
In frame 2 (main) I have my content that is going to be loaded.

The preloader is a simple movieclip of 10 frames.

The code that you wrote, where shall it put it and what do I need to give an instance name etc. if thats necessary?

😃

---

<div class="post-metadata">

**Author:** ![rawnewdlz](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@rawnewdlz](https://forum.kirupa.com/u/rawnewdlz)\
**Post date:** [April 13, 2006, 2:54pm UTC](https://forum.kirupa.com/t/movieclip-preloader/185438/4 "2006-04-13T14:54:05Z")

</div>

This might help

> **[kirupaForum](https://www.kirupa.com/forum/showthread.php?t=197556)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

---

<div class="post-metadata">

**Author:** ![o111](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/o111/32/2123_2.png) [@o111](https://forum.kirupa.com/u/o111)\
**Post date:** [April 13, 2006, 2:57pm UTC](https://forum.kirupa.com/t/movieclip-preloader/185438/5 "2006-04-13T14:57:36Z")

</div>

okey! thanks rawnewdlz;)

---

<div class="post-metadata">

**Author:** ![o111](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/o111/32/2123_2.png) [@o111](https://forum.kirupa.com/u/o111)\
**Post date:** [April 13, 2006, 3:39pm UTC](https://forum.kirupa.com/t/movieclip-preloader/185438/6 "2006-04-13T15:39:36Z")

</div>

yes:D that was it;)
