# Cant find any topics to suit my needs... Preloading external MC with loadbar in 2004!

**URL:** https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406
**Category:** flash
**Created:** [September 6, 2004, 2:50pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406 "2004-09-06T14:50:05Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![tsavo](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@tsavo](https://forum.kirupa.com/u/tsavo)
#### Post date: [September 6, 2004, 2:50pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/1 "2004-09-06T14:50:05Z")

</div>

Hi all. I have this major problem I hope someone can help me with.  
I simply want to have a preloader with a loadbar to load my external movies in flash 2004… HOW can I do this? Ive been searching all over the net, but cant find anything I can use…

I found this code by “newhopekenny” in a topic, it works fine, but I was wondering if there is some way to adapt it to work in external movies. I’ve tried simply changing the paths but that didnt work out…  
the code Im using is as follows:

```auto
 _root.stop();
// initialize the loadbar
_root.loadBarMC.onEnterFrame = function() {
        // stop the playhead
       
        // declare some variables
        var loaded = _root.getBytesLoaded();
        var total = _root.getBytesTotal();
        var totalPercent = Math.round((loaded/total)*100);
        // make the width of the loadbar
        // equal to the percent loaded
        _root.loadBarMC.loadBar_bar._xscale = totalPercent;
        // echo variables to output window
        trace("loaded = "+loaded);
        trace("total = "+total);
        trace("loadBar width = "+totalPercent);
        // if the movie is loaded, get the
        // playhead going again
        if (loaded == total) {
                _root.loadBarMC.gotoAndPlay("loaded");
                _root.gotoAndPlay(2);
                trace("Loaded!");
                // clear the onEnterFrame event
                // so that it's not still running
                // when it doesn't need to be
                delete this.onEnterFrame;
        }
};

```

Thx! :}

---

<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 6, 2004, 5:03pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/2 "2004-09-06T17:03:05Z")

</div>

try the MovieClipLoader class !!  
with this class you can load external .jpg and .swf into your movie  
e.g.

myLoader = new MovieClipLoad();  
myListener = new Object();

myListener.onLoadProgress = function(target\_mc,loadedBytes,totalBytes){

target\_mc.percentageLoader.\_xscale = loadedBytes/totalBytes\*100;

}

myLoader.addListener(myListener);  
myLoader.load(“myClip.swf”,myTarget\_mc);

hope i could help you

---

<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 6, 2004, 5:46pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/3 "2004-09-06T17:46:30Z")

</div>

Thx for replying Pete!  
I’ll have a look at 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 6, 2004, 6:32pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/4 "2004-09-06T18:32:33Z")

</div>

Ok… I can’t get it to work! I need a little more info about the code!  
Right now I have this, in the frame that holds my empty MC.

myLoader = new MovieClipLoad();  
myListener = new Object();

myListener.onLoadProgress = function(MCholder,loadedBytes,totalBytes){

MCholder.LoadBar.\_xscale = loadedBytes/totalBytes\*100;

}  
myLoader.addListener(myListener);  
myLoader.load(“myClip.swf”,MCholder);

-where “MCholder” is the name og my empty MC and “LoadBar” is the name of the percentence-loader (where should I place that one? right now I’ve put it in the first frame of the external movie, but that obiously doesn’t work! nothing gets loaded!

If u could just guide me a little bit, that would be great!  
I appoligize for my stupiddity!!!

Thanks for your help! 😏

---

<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 6, 2004, 8:37pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/5 "2004-09-06T20:37:52Z")

</div>

hey,  
dont say that you are stupid !!  
sorry if i let you think so  
i made a little mistake in my script because the percentage movie should always be one level upper the movie in which it is loaded in.

here a .fla file for total clarity  
i loaded in a picture (from blizzard) into an empty “container” which is in the \_root level. there is also a preloader movie with the loadbar and textfield.  
the reason why i load a picture from the internet and not from the local drive(and if you test it on the local drive for sure) is that i found out that if i load a pic or swf from local drive the onLoadProgress listener is not invoked( that is a little bit funny) !  
but if you test in the web everything works properly.

---

<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 6, 2004, 9:34pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/6 "2004-09-06T21:34:32Z")

</div>

Hi Pete!  
This definetly cleared up some things for me about the movieClipLoader!  
However, there is a “but”!! :h:  
I tried making a flash from scratch, using your code, it works perfectly!  
But, when I put the code in the movie im working with, it does not. I must be doing something wrong. I’ve even tried to copy-paste the frames from your flash, but nothing!  
If u got time, could u try to take a look at my flash? I’ve stripped it down so the filesize isnt so big!  
Thx for all your help!  
🙂

---

<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 6, 2004, 9:51pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/7 "2004-09-06T21:51:38Z")

</div>

okay,  
just upload your file  
or send it to my mail address

---

<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 6, 2004, 10:09pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/8 "2004-09-06T22:09:52Z")

</div>

hmm thats wierd! thought I did!  
I’ll try 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 6, 2004, 11:55pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/9 "2004-09-06T23:55:21Z")

</div>

i had a smiliar problem…  
If you find out what the problem was please post the fixed code/solution here.

---

<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 7, 2004, 9:55am UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/10 "2004-09-07T09:55:01Z")

</div>

okay  
it would have been very helpful if you had said that you publish your movies in flash player 6 becaus MovieClipLoader class is first available in flash player 7.  
but does not matter !!  
here is the final .fla now it should work correctly 😉

and here the final code:

```auto

loadin("http://www.blizzard.com/wow/images/screens/all/ss154.jpg");

function loadin(movie:String){
var BYTESTOTAL:Number = container.getBytesTotal();
container.loadMovie(movie);
preloader.loader._xscale = 0;
preloader.percText.text = "0%";
preloader.onEnterFrame = function(){
	if(container.getBytesTotal()>BYTESTOTAL){
	var perc:Number = Math.round(container.getBytesLoaded()/container.getBytesTotal()*100);
	this.loader._xscale = perc;
	this.percText.text = perc + "%";
		if(perc == 100){
			this.onEnterFrame = null;
		}
	}
}
} 

```

---

<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 7, 2004, 1:13pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/11 "2004-09-07T13:13:32Z")

</div>

\*\*\*\*! I knew it was for some lame reason it didn’t work! I never would have thought of tjecking my publish settings though!!  
Thank u so much for helping me out! 😃

---

<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 7, 2004, 8:14pm UTC](https://forum.kirupa.com/t/cant-find-any-topics-to-suit-my-needs-preloading-external-mc-with-loadbar-in-2004/63406/12 "2004-09-07T20:14:11Z")

</div>

> [@tsavo](#):
>
> \*\*\*\*! I knew it was for some lame reason it didn’t work! I never would have thought of tjecking my publish settings though!!  
> Thank u so much for helping me out! 😃

ohhh,  
I know the moviecliploaded class first came out with flash player 7, but i didn’t know that it wouldn’t work if you published it to flash player 6, wouldn’t flash give you an error that some of the code isn’t compatible?
