# AS2/CS3 onResize Center problem

**URL:** <https://forum.kirupa.com/t/as2-cs3-onresize-center-problem/303252>\
**Category:** flash\
**Created:** [January 17, 2010, 7:46pm UTC](https://forum.kirupa.com/t/as2-cs3-onresize-center-problem/303252 "2010-01-17T19:46:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris874](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@chris874](https://forum.kirupa.com/u/chris874)\
**Post date:** [January 17, 2010, 7:46pm UTC](https://forum.kirupa.com/t/as2-cs3-onresize-center-problem/303252/1 "2010-01-17T19:46:47Z")

</div>

Hi,

Working on my portfolio. Doing it in AS2, and I have it as a liquid layout with the background scaling to fit the browser and some page elements locking to the right and bottom of the page.

Here’s where I’m having a problem - I want to have a project detail clip open on top of everything, centered. I accomplish that just fine with this code:

var list:Object = new Object();  
list.onResize = function(){  
detail1.\_x = Stage.width / 2 - detail1.\_width / 2;  
detail1.\_y = Stage.height / 2 - detail1.\_height / 2;  
}  
Stage.addListener(list);

list.onResize();

Problem is, once I resize the browser window, it jumps the clip to the middle left side of the stage.

Any help would be GREATLY appreciated. I hope that’s enough of a description - please let me know if you need more and I’ll try to describe it better.

Thanks!
