# Centering a linked MC in AS3

**URL:** <https://forum.kirupa.com/t/centering-a-linked-mc-in-as3/227589>\
**Category:** flash\
**Created:** [May 31, 2007, 3:04pm UTC](https://forum.kirupa.com/t/centering-a-linked-mc-in-as3/227589 "2007-05-31T15:04:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mediashock](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Mediashock](https://forum.kirupa.com/u/Mediashock)\
**Post date:** [May 31, 2007, 3:04pm UTC](https://forum.kirupa.com/t/centering-a-linked-mc-in-as3/227589/1 "2007-05-31T15:04:48Z")

</div>

hey i just learned that you need the

```auto

stage.align = StageAlign.TOP_LEFT;

```

in order to center a mc on the stage correctly…

```auto
var mainContent = new mainContentMC;
addChild(mainContent);

stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, onChangeResize);

//setting up the positions
mainContent.x = stage.stageWidth/2;
mainContent.y = stage.stageHeight/2;

function onChangeResize(e:Event)
{
//mainMenu.x = stage.stageWidth/2;
mainContent.x = stage.stageWidth/2;
mainContent.y = stage.stageHeight/2;
}

```

most of you may had already known this but i thought i’d post it. 😉
