# Auto-Resizing and Centering your Content tutorial

**URL:** https://forum.kirupa.com/t/auto-resizing-and-centering-your-content-tutorial/294241
**Category:** flash
**Created:** [August 11, 2009, 11:16am UTC](https://forum.kirupa.com/t/auto-resizing-and-centering-your-content-tutorial/294241 "2009-08-11T11:16:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![arsenalfc](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@arsenalfc](https://forum.kirupa.com/u/arsenalfc)
#### Post date: [August 11, 2009, 11:16am UTC](https://forum.kirupa.com/t/auto-resizing-and-centering-your-content-tutorial/294241/1 "2009-08-11T11:16:27Z")

</div>

I’ve just run through this tutorial and I’ve got my site centering in my browser as planned.

[http://www.kirupa.com/developer/as3/resizing\_centering\_as3.htm](http://www.kirupa.com/developer/as3/resizing_centering_as3.htm)

However when I resize my browser window the text (I’m using a pixel font) is going fuzzy.

Is there some way I can lock ‘centerRectangle’ to a rounded X and Y coordinate so that this doesn’t happen?

```auto
function init()
{
stage.align=StageAlign.TOP_LEFT;
stage.scaleMode=StageScaleMode.NO_SCALE;
 
stage.addEventListener(Event.RESIZE, updateSize);
stage.dispatchEvent(new Event(Event.RESIZE));
 
backgroundRectangle.x = 0;
backgroundRectangle.y = 0;
}

init();
 
function updateSize(e:Event)
{
//Set background's size
backgroundRectangle.width = stage.stageWidth;
backgroundRectangle.height = stage.stageHeight;
 
//center content
centerRectangle.x = stage.stageWidth/2 - centerRectangle.width/2;
centerRectangle.y = stage.stageHeight/2 - centerRectangle.height/2;
}

```
