# Resize image container

**URL:** <https://forum.kirupa.com/t/resize-image-container/263839>\
**Category:** Uncategorized\
**Created:** [June 19, 2008, 4:27pm UTC](https://forum.kirupa.com/t/resize-image-container/263839 "2008-06-19T16:27:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjwilden](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@cjwilden](https://forum.kirupa.com/u/cjwilden)\
**Post date:** [June 19, 2008, 4:27pm UTC](https://forum.kirupa.com/t/resize-image-container/263839/1 "2008-06-19T16:27:41Z")

</div>

[FONT=“Arial”][/FONT]  
I am trying to have a slide show that has photos pulled through via XML, this all works. I am now trying to get the image container to resize to the size/shape of the new pic, can someone please help!!! I have looked at this code and tried putting it into my actionscript but I am still new to all of this -

MovieClip.prototype.resizeMe = function(w, h){  
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){  
this.\_width = w;  
this.\_height = h;  
\_root.containerMC.\_x = this.\_x - this.\_width/2 + spacing/2;  
\_root.containerMC.\_y = this.\_y - this.\_height/2 + spacing/2;

```
		//_root.containerMC._alpha = 100;
		delete this.onEnterFrame;
	}
}

```

Here is the script that I am using -

import mx.transitions.Tween;  
import mx.transitions.easing.\*;

var myShowXML = new XML();  
myShowXML.ignoreWhite = true;  
myShowXML.load(“slideshow.xml”);

myShowXML.onLoad = function() {  
\_root.myWidth = myShowXML.firstChild.attributes.width;  
\_root.myHeight = myShowXML.firstChild.attributes.height;  
\_root.mySpeed = myShowXML.firstChild.attributes.speed;  
\_root.myImages = myShowXML.firstChild.childNodes;  
\_root.myImagesNo = myImages.length;  
import flash.filters.DropShadowFilter;  
var shadowEffect:DropShadowFilter = new DropShadowFilter(3, 45, 0x999999, 100, 3, 3, 1, 3);  
var picFilter:Array = [shadowEffect];

createContainer();  
callImages();  
};

function createContainer() {

\_root.createEmptyMovieClip(“myContainer\_mc”, \_root.getNextHighestDepth());

myContainer\_mc.lineStyle(1,0x999999,20);  
myContainer\_mc.lineTo(\_root.myWidth,0);  
myContainer\_mc.lineTo(\_root.myWidth,\_root.myHeight);  
myContainer\_mc.lineTo(0,\_root.myHeight);  
myContainer\_mc.lineTo(0,0);

myContainer\_mc.\_x = (Stage.width-myContainer\_mc.\_width)/2;  
myContainer\_mc.\_y = (Stage.height-myContainer\_mc.\_height)/2;

var myShadow = new flash.filters.DropShadowFilter(0,0,3);  
var myTempFilters:Array = myContainer\_mc.filters;  
myTempFilters.push(myShadow);  
myContainer\_mc.filters = myTempFilters;

}

function callImages() {

```
_root.myMCL = new MovieClipLoader();
_root.myPreloader = new Object();

_root.myMCL.addListener(_root.myPreloader);

_root.myClips_array = [];

_root.myPreloader.onLoadStart = function(target) {

	_root.createTextField("myText_txt",_root.getNextHighestDepth(),0,0,100,20);
	
	_root.myText_txt._x = (Stage.width-_root.myText_txt._width)/2;
	_root.myText_txt._y = (Stage.height-_root.myText_txt._height)/2;
	_root.myText_txt.autoSize = "center";

	_root.myText_txt.text = "test";

};

_root.myPreloader.onLoadProgress = function(target) {

	_root.myText_txt.text = "Loading.. "+_root.myClips_array.length+"/"+_root.myImagesNo+" Completed";

};

_root.myPreloader.onLoadComplete = function(target) {

	
	_root.myClips_array.push(target);
	
	target._alpha = 0;

	
	if (_root.myClips_array.length == _root.myImagesNo) {

		
		_root.myText_txt._y = myContainer_mc._y + myContainer_mc._height;
		_root.target_mc = -1;
		
	
		moveSlide();
		
		myShowInt = setInterval(moveSlide, (_root.mySpeed*1000)+1000);

	}

};

for (i=0; i&lt;_root.myImagesNo; i++) {
	
	
	temp_url = _root.myImages*.attributes.url;

	temp_mc = myContainer_mc.createEmptyMovieClip(i, myContainer_mc.getNextHighestDepth());

	
	_root.myMCL.loadClip(temp_url,temp_mc);
}

```

}

function moveSlide() {

```
current_mc = _root.myClips_array[_root.target_mc];
new Tween(current_mc, "_alpha", Strong.easeOut, 100, 0, 1, true);

_root.target_mc++;

if (_root.target_mc&gt;=_root.myImagesNo) {
	_root.target_mc = 0;
}

_root.myText_txt.text = _root.myImages[target_mc].attributes.title;

next_mc = _root.myClips_array[_root.target_mc];
new Tween(next_mc, "_alpha", Strong.easeOut, 0, 100, 1, true);

```

}

Again please help!!!
