Empty movie clip width problems

I’m trying to load images into a row of images. Each image is a different width. Heres the code so far:



var xPos:Number = 0;
for (y=0; y<5; y++) {
	
	var container:MovieClip = this.holder.createEmptyMovieClip("picholder"+y,y);
	container.loadMovie("mypic.jpg");
	container._x = xPos;
	xPos += container._width;

}


The problem at the moment is that the container._width property is reading 0 so all the images are loading on top of each other. This is the same with “picholder”+y. If I set the xPos value to say 100 then it works fine. I’m guessing its something to do with the fact that the loadMovie happens after the var container is defined. Whats a way around this?

Any help much appreciated :smirk:

Also just while I’m posting whats the correct syntax for something like this:
container.loadMovie(“mypic” + (y) +".jpg");