# Resize Script Help!

**URL:** <https://forum.kirupa.com/t/resize-script-help/167172>\
**Category:** flash\
**Created:** [October 26, 2005, 1:07am UTC](https://forum.kirupa.com/t/resize-script-help/167172 "2005-10-26T01:07:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kansai](https://avatars.discourse-cdn.com/v4/letter/k/cdc98d/32.png) [@kansai](https://forum.kirupa.com/u/kansai)\
**Post date:** [October 26, 2005, 1:07am UTC](https://forum.kirupa.com/t/resize-script-help/167172/1 "2005-10-26T01:07:46Z")

</div>

Hello all I recently finsished the XML and Flash Photogallery tutorial found here  
[http://www.kirupa.com/developer/mx2004/xml\_flash\_photogallery.htm](http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm) after reading and understanding the tutorial as much as possible for me I wanted to try and apply a resize script I found here [http://www.kirupa.com/forum/showthread.php?t=87388](http://www.kirupa.com/forum/showthread.php?t=87388) I am using the V3\_with\_thumbs script to try and resize my gallery.

Problem my movie will load fine previous and next buttons work fine but the image does not load in the border frame it loads out side and then snaps into place. I have tried but have failed to try and fix this problem. Any help would be great.

I have attached my .fla file my action script code is listed below

```auto

function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		description = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
			description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
		}
		firstImage();
	} else {
		content = "file not loaded!";
	}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
	if (Key.getCode() == Key.LEFT) {
		prevImage();
	} else if (Key.getCode() == Key.RIGHT) {
		nextImage();
	}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
	prevImage();
};
next_btn.onRelease = function() {
	nextImage();
};
/////////////////////////////////////
p = 0;
spacing = 10;
this.onEnterFrame = function() {
	filesize = picture.getBytesTotal();
	loaded = picture.getBytesLoaded();
	preloader._visible = true;
	if (loaded != filesize) {
		preloader.preload_bar._xscale = 100*loaded/filesize;
	} else {
		preloader._visible = false;
		if (picture._alpha<100) {
			picture._alpha += 10;
			if (Math.round(filesize/loaded) == 1 && picture._width != 0 && picture._height != 0) {
			var w = picture._width+spacing, h = picture._height+spacing;
			border.resizeMe(w, h, id);
			
		}
	}
	}
};

MovieClip.prototype.resizeMe = function(w, h, id) {
	var speed = 3;
	
	this.onEnterFrame = function() {
		this._width += (w-this._width)/speed;
		this._height += (h-this._height)/speed;
		if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
			this._width = w;
			this._height = h;
			picture._x = this._x-this._width/2+spacing/2;
			picture._y = this._y-this._height/2+spacing/2;
			info._y = Math.round(this._y+this._height/2+spacing/2);
			
			
				
			}
		}
	};

function nextImage() {
	if (p<(total-1)) {
		p++;
		if (loaded == filesize) {
			picture._alpha = 0;
			picture.loadMovie(image[p], 1);
			desc_txt.text = description[p];
			picture_num();
		}
	}
}
function prevImage() {
	if (p>0) {
		p--;
		picture._alpha = 0;
		picture.loadMovie(image[p], 1);
		desc_txt.text = description[p];
		picture_num();
	}
}
function firstImage() {
	if (loaded == filesize) {
		picture._alpha = 0;
		picture.loadMovie(image[0], 1);
		desc_txt.text = description[0];
		picture_num();
	}
}
function picture_num() {
	current_pos = p+1;
	pos_txt.text = current_pos+" / "+total;
}

```
