# Preloader Help!

**URL:** https://forum.kirupa.com/t/preloader-help/29852
**Category:** flash
**Created:** [August 31, 2003, 11:42pm UTC](https://forum.kirupa.com/t/preloader-help/29852 "2003-08-31T23:42:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![crazysniper22](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@crazysniper22](https://forum.kirupa.com/u/crazysniper22)
#### Post date: [August 31, 2003, 11:42pm UTC](https://forum.kirupa.com/t/preloader-help/29852/1 "2003-08-31T23:42:18Z")

</div>

Is there a way to create a 1 preloader that can be used to preload external movieclip into the main movie? Not at the same time but only when button is click.

---

<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 1, 2003, 12:38am UTC](https://forum.kirupa.com/t/preloader-help/29852/2 "2003-09-01T00:38:29Z")

</div>

Hello again familiar stranger. Yes there is a way, I’m not exactly sure, but you use it in a similar fasion, you would have something like:

```auto
percent = Math.round((movieclip.getBytesLoaded()/movieclip.getBytesTotal())*100) add "%"

```

and a text box with percent as the var.

Let me check my big flash book.

---

<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 1, 2003, 1:26am UTC](https://forum.kirupa.com/t/preloader-help/29852/3 "2003-09-01T01:26:12Z")

</div>

Alright, I’ve got it.

Create an empty movieClip where you want the top left hand corner of the loaded movie clip to appear - we will name it “spotload”.

now, add this to the script that will trigger the loading of the movieclip:

```auto
loadMovie("movieclipname.swf", _root.spotload)

```

in a seperate blank movieclip, add this:

```auto
onClipEvent(enterFrame){
percent = Math.round((movieclip.getBytesLoaded()/movieclip.getBytesTotal())*100);
}

```

then create a textfeild somewhere with var as: percent.

that should do the trick.

---

<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 1, 2003, 3:52am UTC](https://forum.kirupa.com/t/preloader-help/29852/4 "2003-09-01T03:52:45Z")

</div>

First create an empty movie clip and give it an instance name of _container\_mc_. Then lets call your button _my\_button_. Now create a textfield and give it a variable name _percent_.  
On the main timeline, place the following code:[AS]function preload(clip) {  
if (!loaded) {  
if (clip.getBytesLoaded\>0 && clip.getBytesLoaded\>=clip.getBytesTotal) {  
loaded = true;  
}  
var percent = Math.round((clip.getBytesLoaded()/clip.getBytesTotal())\*100);

```
}

```

}  
my\_button.onPress = function() {  
container\_mc.loadMovie(“yourmovie.swf”);  
};[/AS]Now, apply the following code on your container\_mc:

```auto

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

```

---

<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 2, 2003, 12:49am UTC](https://forum.kirupa.com/t/preloader-help/29852/5 "2003-09-02T00:49:42Z")

</div>

thanks for the replies guys! if do those is this what will gonna happen?

if i click the home “button”, that preloaders come out, and if i click on “profile” for instance, that preloader will also comes up as well?

thanks i’ll try those you guys advised me to do!
