# Center to Stage

**URL:** <https://forum.kirupa.com/t/center-to-stage/148704>\
**Category:** Uncategorized\
**Created:** [May 22, 2005, 8:09pm UTC](https://forum.kirupa.com/t/center-to-stage/148704 "2005-05-22T20:09:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Macro\_design](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Macro\_design](https://forum.kirupa.com/u/Macro_design)\
**Post date:** [May 22, 2005, 8:09pm UTC](https://forum.kirupa.com/t/center-to-stage/148704/1 "2005-05-22T20:09:23Z")

</div>

Now, I was just playing a little around with some Stage scripting, when I decided it could be fun to make an AS, that, when the window (e.g. the internet explorer window) is resized by the user, then the content - dynamically loaded content - is sliding to the center of the screen.

I got the function to work, almost. The content is loaded into a movieClip, with the instance name: “mc” (very original;)). And the “mc” is moving to some center point, but not the center of the screen.

My AS:  
[AS]loadMovie(“test.swf”, mc);  
onEnterFrame = function () {  
mc.xMove = (Stage.width)/2;  
mc.yMove = (Stage.height)/2;  
};[/AS]And then I added a little easing to the move, I just wrote the code on the “mc”, here it is:  
[AS]onClipEvent (load) {  
xMove = \_x;  
yMove = \_y;  
easeSpeed = 10;  
}  
onClipEvent (enterFrame) {  
\_x += Math.round((xMove-\_x)/easeSpeed);  
\_y += Math.round((yMove-\_y)/easeSpeed);  
}[/AS]The test.swf is 400px X 400px, can anyone help me out on this?
