# Preloading external images

**URL:** https://forum.kirupa.com/t/preloading-external-images/49413
**Category:** Uncategorized
**Created:** [April 22, 2004, 2:28pm UTC](https://forum.kirupa.com/t/preloading-external-images/49413 "2004-04-22T14:28:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![macneilslt](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@macneilslt](https://forum.kirupa.com/u/macneilslt)
#### Post date: [April 22, 2004, 2:28pm UTC](https://forum.kirupa.com/t/preloading-external-images/49413/1 "2004-04-22T14:28:18Z")

</div>

Okay, i found this AS on a site for prealoading external images.

```auto

stop();
//stage
Stage.showMenu = false;
Stage.scaleMode = "noScale";

MovieClip.prototype.preloadjpg = function(movietobeLoaded) {
	var holder = this.createEmptyMovieClip("holder", 1);
	holder.loadMovie(movietobeLoaded);
	this.onEnterFrame = function() {
		holder._visible = false;
		var tLoaded, tBytes;
		tLoaded = holder.getBytesLoaded();
		tBytes = holder.getBytesTotal();
		var percentage = int(tLoaded * 100 / tBytes);
		info_txt.text = percentage + " % of " + movietobeLoaded + " loaded";
		if (isNaN(tBytes) || tBytes < 4) {
			return;
		}
		if (tLoaded / tBytes >= 1) {
			
			placeholder_mc.loadMovie(movietobeLoaded);
			info_txt.text = movietobeLoaded + " is loaded & displayed";
			delete this.onEnterFrame;
		}
	};
};

this.placeholder_mc._x = this.placeholder_mc._y = 0;

```

I’m not really sure how to use it…  
Questions:

How can i load images into that preloader using buttons? i’m not really sure how it works in general, I’m not completely AS illiterate, i’m just confused about this, also is it possibl to load them into mcs i already have on the stage, instead of using the AS declared place holder mc?

If anyone has time, an example .fla would be _greatly_ apprciated…if not, an explanation would help…
