Problem positioning MovieClip center stage

Hi,

My stage dimensions are 400x400.

I’ve drawn a ball on the stage and sized it so its dimensions are 50x50.

I’ve then converted it to a MovieClip (registration point is set to center).

I’ve given the MovieClip and instance name of “gameBall” and set the x,y to 0.

In my actionscript panel I’ve entered the following code…

gameBall.x = stage.stageWidth / 2;
gameBall.y = stage.stageHeight / 2;

…which I would hope would position the MovieClip to the center of the screen but it doesn’t. The x position is correct but the y position of the MovieClip is heigher than center.

I’ve managed to get this to work by adding the height of the ball again to the y position, for example…

gameBall.x = stage.stageWidth / 2;
gameBall.y = (stage.stageHeight / 2) + 50;

…but I don’t really understand why this is?

Thanks! :slight_smile:

Kind regards,
M.

try this:

[AS]stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;[/AS]

if you mark your point x:0 y:0 in your stage, with a crosshair grafic for example, it will help you to see the difference.