Loading image with random sizes but same place

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 :slight_smile:

thanks in advance!