# {flash as2 xml gallery} post unloadmovie keeps dimensions?

**URL:** <https://forum.kirupa.com/t/flash-as2-xml-gallery-post-unloadmovie-keeps-dimensions/254181>\
**Category:** flash\
**Created:** [March 9, 2008, 8:15am UTC](https://forum.kirupa.com/t/flash-as2-xml-gallery-post-unloadmovie-keeps-dimensions/254181 "2008-03-09T08:15:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuengling](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@yuengling](https://forum.kirupa.com/u/yuengling)\
**Post date:** [March 9, 2008, 8:15am UTC](https://forum.kirupa.com/t/flash-as2-xml-gallery-post-unloadmovie-keeps-dimensions/254181/1 "2008-03-09T08:15:27Z")

</div>

I’ve got an xml gallery with thumbnails that when clicked launch a full screen scaled version of the photo. I’m having a little trouble adding the ability to zoom the scaled version of the full screen photo after its loaded. The problem happens after loading an image in the full screen picture movieclip and then unloading that movieclip. When I load a new image from the thumbnail list the picture movieclip it is still holding the previous images dimensions. Shouldn’t the movieclip automatically take the dimensions of the newly loaded image??? I’ve tried several different tactics such as grabbing the image dimensions on the onloadinit etc. and can’t get anything to work. Any help would be GREATELY appreciated I’ve been banging my head against the wall all day trying to figure this out.

Thanks!

-Yuengling

Source:  
**image preloader and sub functions(using fusekit for animation)**

```auto
var mcl:MovieClipLoader = new MovieClipLoader();

var mclL:Object = new Object();

mclL.onLoadProgress = function(picture,loaded,total) {
	load_box.load_bar._xscale = (loaded/total * 100);
	Mouse.hide();
	load_box._x = _root._xmouse;
	load_box._y = _root._ymouse;
}

mclL.onLoadInit = function(picture_mc) {
	picture_mc.orig_width = picture_mc._width;
	picture_mc.orig_height = picture_mc._height;
	fullScreenPic();
	
	load_box.load_bar._xscale = 0;
	load_box._visible = false;
	controlbar_mc._visible = true;
	picture_mc._alpha = 0;
	ZigoEngine.doTween(blackmask, "_alpha", 100, 0.2, "linear");
	ZigoEngine.doTween(picture_mc, "_alpha", 100, 1, "linear", 0, load_text);
	ZigoEngine.doTween(controlbar_mc, "_alpha", 100, 0.3, "linear", 1);
	Mouse.show();
	
	picture_mc.onEnterFrame = function() {
			if(_root._ymouse > 25) {
				Mouse.hide();
				zoom_mc._x = _root._xmouse;
				zoom_mc._y = _root._ymouse;
				zoom_mc.swapDepths(_root.getNextHighestDepth());
				zoom_mc._visible = true;
			} else {
				zoom_mc._visible = false;
				Mouse.show();
			}
			
	};

	picture_mc.onRelease = function() {
		if(zoomed == false) {
		ZigoEngine.doTween(picture_mc, "_width, _height", [picture_mc.orig_width, picture_mc.orig_height], 0.8, "easeInOutExpo");
		ZigoEngine.doTween(picture_mc, "_y, _x", [picture_mc._y - 300, picture_mc._x - 300], 0.8, "easeInOutExpo", 0);
		zoomed = true;
		} else {
		ZigoEngine.doTween(picture_mc, "_width, _height", [picture_mc.scaled_width, picture_mc.scaled_height], 0.8, "easeInOutExpo");
		ZigoEngine.doTween(picture_mc, "_y, _x", [0, 0], 0.8, "easeInOutExpo", 0);
		zoomed = false;
		}
	}
	
	function load_text() {
		_root.controlbar_mc.desc_txt.text = titles[p];
	}
	
}

mcl.addListener(mclL);

```

**image resize**

```auto
function fullScreenPic() {
	
	if (Stage.height/Stage.width>picture._height/picture._width) {
		img_prop = picture._width/picture._height;
		picture._height = Stage.height;
		picture._width = Stage.height*img_prop;
		picture._y = 0;
		picture._x = 0;
	} else {
		img_prop = picture._height/picture._width;
		picture._width = Stage.width;
		picture._height = Stage.width*img_prop;
		picture._y = 0;
		picture._x = 0;
	}

	picture.scaled_width = picture._width;
	picture.scaled_height = picture._height;

}

```

**thumbnail click full pic load**

```auto
mcl.loadClip(image[p],picture);

```

**unload movie**

```auto
unloadMovie("_root.picture");

```
