[FMX] Preloader loading external movie clips

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


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 :slight_smile:

Well thanks for the help… :stuck_out_tongue: