# How to resize an image using Loadclip()

**URL:** <https://forum.kirupa.com/t/how-to-resize-an-image-using-loadclip/261339>\
**Category:** flash\
**Created:** [May 26, 2008, 5:52pm UTC](https://forum.kirupa.com/t/how-to-resize-an-image-using-loadclip/261339 "2008-05-26T17:52:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cynicsound\_mac](https://avatars.discourse-cdn.com/v4/letter/c/ebca7d/32.png) [@cynicsound\_mac](https://forum.kirupa.com/u/cynicsound_mac)\
**Post date:** [May 26, 2008, 5:52pm UTC](https://forum.kirupa.com/t/how-to-resize-an-image-using-loadclip/261339/1 "2008-05-26T17:52:49Z")

</div>

Hi,

I’m doing a very simple slideshow, I was using loadmovie(), but trying to implement a preloader for each photo, I had to change to loadclip() to add the listener. Now I can’t resize, I don’t know how to do it.

I found the tutorial for the preloaders here, ([http://www.kirupa.com/developer/acti...cliploader.htm](http://www.kirupa.com/developer/acti...cliploader.htm)) which is great, but if the pictures have different size, I don’t know how to resize them so they fit to the border.

I hope someone can help. Thanks!

---

<div class="post-metadata">

**Author:** ![cynicsound\_mac](https://avatars.discourse-cdn.com/v4/letter/c/ebca7d/32.png) [@cynicsound\_mac](https://forum.kirupa.com/u/cynicsound_mac)\
**Post date:** [May 26, 2008, 6:32pm UTC](https://forum.kirupa.com/t/how-to-resize-an-image-using-loadclip/261339/2 "2008-05-26T18:32:46Z")

</div>

Well, I wrote this and two minutes later I found the solution…

I’ll post it here in case that someone needs it as I needed before. But trust me, I spent a lot of time and nothing was working…

photo is a

> 

```
    photo = _root.createEmptyMovieClip("clip", 1);
    photo.createEmptyMovieClip("holder",1);

    photo.holder.loadMovie("URL of the photo");

```

// Taking initial position from the frame, +20 because it’s bigger than the picture.  
photo.\_x = getProperty(frame,\_x)+20;  
photo.\_y = getProperty(frame,\_y)+20;  
photo.onEnterFrame = function() {  
//make sure it has started loading  
if (this.holder.getBytesLoaded()\>4) {  
if (this.holder.getBytesLoaded()\<this.holder.getBytesTotal()) {

```
			pos=Math.floor((this.holder.getBytesLoaded() / this.holder.getBytesTotal())*100);
                            // To manage the preloader, I put a dynamic Text box in which I write the percent
			loading.text=pos + "%"; 
                            // and also a bar, with 100 frames, each frame bigger, as all preloaders hehe
			bar2.gotoAndStop(pos);
		} else {
                            // and now, when the image is loaded, we finally can resize it!
			this._width = 150;
			this._height = 150;
			this.onEnterFrame = null;
                            // both dynamic text and bar2 dissappear
			loading._visible=false; 
			bar2._visible=false;
		}
	}
};

```

This is just part of the slideshow I made, it takes the location of the photos from a XML file, if someone wants the source, I can post it.

Thanks and sorry for this stupid post
