# \[FMX\] Preloader loading external movie clips

**URL:** https://forum.kirupa.com/t/fmx-preloader-loading-external-movie-clips/12362
**Category:** flash
**Created:** [January 30, 2003, 4:53am UTC](https://forum.kirupa.com/t/fmx-preloader-loading-external-movie-clips/12362 "2003-01-30T04:53:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Bezzer](https://avatars.discourse-cdn.com/v4/letter/b/71e660/32.png) [@Bezzer](https://forum.kirupa.com/u/Bezzer)
#### Post date: [January 30, 2003, 4:53am UTC](https://forum.kirupa.com/t/fmx-preloader-loading-external-movie-clips/12362/1 "2003-01-30T04:53:49Z")

</div>

I’m writing a preloader to load external movie clips but my function doesn’t seem to be working properly. I call the function and it says that 100% is loaded and makes the movie clip thats showing the out put invisible…thats what supposed to happen except for the going to 100% straight away. the percent is being calculated properly but i think that the function is being executed before the new movie even starts to load…i’ve tried movieClip.onData but it doesn’t seem to work…

Well heres the code

```auto

function loader() {
	percentClip._visible = true;
	targetClip._visible = false;
	percent = 0;
	onEnterFrame = function () {
		if (percent == 100) {
			percentClip._visible = false;
			targetClip._visible = true;
			onEnterFrame = null;
		}
		percent = Math.floor(targetClip.getBytesLoaded()/targetClip.getBytesTotal())*100;
		percentClip.textBox.text = "Movie is loading, "+percent+"% is loaded";
	};
}

```

Ok thanks 🙂

---

<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: [February 5, 2003, 6:50am UTC](https://forum.kirupa.com/t/fmx-preloader-loading-external-movie-clips/12362/2 "2003-02-05T06:50:14Z")

</div>

Well thanks for the help… 😛
