# Need Help with a Preloader Problem

**URL:** https://forum.kirupa.com/t/need-help-with-a-preloader-problem/30043
**Category:** Uncategorized
**Created:** [September 3, 2003, 7:11am UTC](https://forum.kirupa.com/t/need-help-with-a-preloader-problem/30043 "2003-09-03T07:11:52Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![BlackShadow](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@BlackShadow](https://forum.kirupa.com/u/BlackShadow)
#### Post date: [September 3, 2003, 7:11am UTC](https://forum.kirupa.com/t/need-help-with-a-preloader-problem/30043/1 "2003-09-03T07:11:52Z")

</div>

I have the buttons load movie clips into a small area underneath them but I want to have a preloader that will load the movie instead of just opening it… What can I do?

---

<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 3, 2003, 7:24am UTC](https://forum.kirupa.com/t/need-help-with-a-preloader-problem/30043/2 "2003-09-03T07:24:27Z")

</div>

Place the following on contents mc:

```auto
onClipEvent (enterFrame) {
        if (this._url != _root._url) {
                _root.preload(this);
        }
}

```

Now the following code on main timeline. Note that you must have a textfield with an instance name of _percent_ and a loadbar (check the preloader tutorials on kirupa) with an instance name of _loadBar_. Both on root.

```auto
buttons_array = ["Home", "Downloads", "Events", "Speak Your Mind"];//your buttons INSTANCE names
function enableButton() {
        this.enabled = false;
        this._parent.contents.loadMovie(new String(this).substring(8, this.length)+".swf");
        for (var i in buttons_array) {
                if (this._parent[buttons_array*]._name != this._name) {
                        this._parent[buttons_array*].enabled = true;
                }
        }
}
for (var j in buttons_array) {
        this[buttons_array[j]].onPress = enableButton;
}
function preload(clip) {
        if (!loaded) {
                if (clip.getBytesLoaded>0 && clip.getBytesLoaded>=clip.getBytesTotal) {
                        loaded = true;
                }
                var percent = Math.round((clip.getBytesLoaded()/clip.getBytesTotal())*100);
                loadBar._width = 100*percent; //replace 100 for your loadbar width
        }
}

```

Untested though :-\

---

<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 3, 2003, 3:40pm UTC](https://forum.kirupa.com/t/need-help-with-a-preloader-problem/30043/3 "2003-09-03T15:40:28Z")

</div>

Now do I put the preload bar in the movie clip that will be loaded or in the whole thing itself…?

---

<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 3, 2003, 4:26pm UTC](https://forum.kirupa.com/t/need-help-with-a-preloader-problem/30043/4 "2003-09-03T16:26:10Z")

</div>

On the main movie  
You can set its visibility to false by default and when you need it, set it visible again.

---

<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 3, 2003, 4:54pm UTC](https://forum.kirupa.com/t/need-help-with-a-preloader-problem/30043/5 "2003-09-03T16:54:52Z")

</div>

Ok…I’m just trying this test but it doesn’t seem to show the preloader when I preview it… Ⓜ

---

<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 3, 2003, 4:56pm UTC](https://forum.kirupa.com/t/need-help-with-a-preloader-problem/30043/6 "2003-09-03T16:56:13Z")

</div>

And here is the first content it loads…

---

<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 3, 2003, 4:58pm UTC](https://forum.kirupa.com/t/need-help-with-a-preloader-problem/30043/7 "2003-09-03T16:58:09Z")

</div>

I dont get it… you are using a totally different code and you have no preloading actions on your code.

---

<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 3, 2003, 4:59pm UTC](https://forum.kirupa.com/t/need-help-with-a-preloader-problem/30043/8 "2003-09-03T16:59:19Z")

</div>

Get the second attachment I put there…that one has the preloader code in it.
