# Preloader for image-resize gallery

**URL:** <https://forum.kirupa.com/t/preloader-for-image-resize-gallery/159542>\
**Category:** flash\
**Created:** [August 18, 2005, 7:06am UTC](https://forum.kirupa.com/t/preloader-for-image-resize-gallery/159542 "2005-08-18T07:06:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![r4ndom](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@r4ndom](https://forum.kirupa.com/u/r4ndom)\
**Post date:** [August 18, 2005, 7:06am UTC](https://forum.kirupa.com/t/preloader-for-image-resize-gallery/159542/1 "2005-08-18T07:06:59Z")

</div>

Hey, great forums, you guys sure know your stuff around here. I currently have a bit of a problem, i’m trying to create an image-resize gallery with a preloader. This is currently what it looks like:

containerMC  
button1

Actionscript on frame1

```auto
spacing = 10;
containerMC._alpha = 0;
MovieClip.prototype.loadPic = function (pic)
{
	containerMC._alpha = 0;
	this.loadMovie(pic);
	onEnterFrame = function ()
	{
		var t = containerMC.getBytesTotal();
		var l = containerMC.getBytesLoaded();
		if (t != 0 && Math.round(l / t) == 1 && containerMC._width > 2)
		{
			var w = containerMC._width + spacing;
			var h = containerMC._height + spacing;
			border.resizeMe(w, h);
			delete onEnterFrame;
		} // end if
	};
};
MovieClip.prototype.resizeMe = function (w, h)
{
	var speed = 3;
	this.onEnterFrame = function ()
	{
		this._width = this._width + (w - this._width) / speed;
		this._height = this._height + (h - this._height) / speed;
		if (Math.abs(this._width - w) < 1)
		{
			this._width = w;
			this._height = h;
			containerMC._x = this._x - this._width / 2 + spacing / 2;
			containerMC._y = this._y - this._height / 2 + spacing / 2;
			containerMC._alpha = containerMC._alpha + 9;
			if (containerMC._alpha > 90)
			{
				containerMC._alpha = 100;
				delete this.onEnterFrame;
			} // end if
		} // end if
	};
};

```

and on button1 i have

```auto
on (release)
{
	containerMC.loadPic("image.jpg");
}

```

I was just wondering if anyone knew an easy way of setting a preloader of some sort to load the .jpg and then resizes?

Cheers for taking the time to read my post 🙂
