Centering in the stage

Hi, I have an image gallery but at the moment the image is aligning top left in the window. I would like it to center in the stage if possible.

The code I have at the moment is:

function setPositions () {
container.img._x = (Stage.width-container.img._width)/2;
container.img._y = (Stage.height-container.img._height)/2;
}

Could some one please help me with the right code to center the container in the stage?

THanks in advance, it’s really appreciated!

pj

For some reason the mc i am trying to center, when the values are set to _x=0 and _y=0, the mc is centered in the middle of the main mc at the top left corner of the mc.

Does anyone know why this occurs?

So therefore it doesn’t work for me.

instead i did

this.imageMC._x = 0-(this.imageMC._width/2)