# Loading image with random sizes but same place

**URL:** https://forum.kirupa.com/t/loading-image-with-random-sizes-but-same-place/210328
**Category:** Uncategorized
**Created:** [December 17, 2006, 9:27pm UTC](https://forum.kirupa.com/t/loading-image-with-random-sizes-but-same-place/210328 "2006-12-17T21:27:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Anthalus](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@Anthalus](https://forum.kirupa.com/u/Anthalus)
#### Post date: [December 17, 2006, 9:27pm UTC](https://forum.kirupa.com/t/loading-image-with-random-sizes-but-same-place/210328/1 "2006-12-17T21:27:16Z")

</div>

hello!

i have a swf with a list of images on the left and what i want to do is when i click in the image , it will creat an empty movieclip and send an image inside.

i know how to do this, but the problem is that i have a 300x200, 200x300 and another sizes, but the max width and hiehgt is 300x300, so i need a 300x300 movieclip and my dificultie is to make the images stay exactly in the middle of the invisible movieclips o they dotn load around places i dont want to

im trying with this:

\*\*

// creating clips

this.createEmptyMovieClip(“containerFoto”, this.getNextHighestDepth());  
containerFoto.createEmptyMovieClip(“foto”, containerFoto.getNextHighestDepth());  
var fotoLoader:MovieClipLoader = new MovieClipLoader();  
fotoLoader.loadClip(“imagens/fotos/1.jpg”, containerFoto.foto);  
containerFoto.\_visible = false;

//trying to get the width and height of the just loaded image

```
var novaWidth:Number = containerFoto.foto._width;
var novaHeight:Number = containerFoto.foto._height;

```

if (novaWidth \<=300){  
containerFoto. \_x = 400;  
} else{  
containerFoto.\_x = 250;  
}

containerFoto.\_visible = true;\*\*

in this code the problem is that im notgettting the width and hieght of the image.

annyone knows a simple way to do this? thanks and if you dont understand something plz tell 🙂

thanks in advance!
