# myListener.onResize

**URL:** <https://forum.kirupa.com/t/mylistener-onresize/247780>\
**Category:** flash\
**Created:** [December 29, 2007, 3:30pm UTC](https://forum.kirupa.com/t/mylistener-onresize/247780 "2007-12-29T15:30:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![manny2k](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@manny2k](https://forum.kirupa.com/u/manny2k)\
**Post date:** [December 29, 2007, 3:30pm UTC](https://forum.kirupa.com/t/mylistener-onresize/247780/1 "2007-12-29T15:30:46Z")

</div>

I could do with some help on Stage.addListener. I’m a bit lost at the minute

Right I have an Movieclip named studio\_mc sitting on stage and I have 2 buttons, 1 button slides the studio\_mc to the centre of the stage using

Studio\_mc.ySlideTo ( Stage.height/2,1,”easeOutExpo”)

And the other button slides the studio\_mc off stage using

Studio\_mc.ySlideTo ( Stage.height-250,1,”easeOutExpo”)

Both \_x positions are also set up for centre stage too, no problems there and everything works fine and the movieclip moves on and off stage depending on what button is pressed. What I have a problem with is the myListener. onResize function.

What do I have to set up for the Stage listener to reset the position of the studio\_mc to Stage.height/2 whilst its on stage and to Stage.height-250 if its of stage when the browser is resized, been driving me nuts

I can’t use this

var myListener:Object = new Object ();  
myListener.onResize = function(){  
studio\_mc.ySlideTo(Stage.height/2,1,”easeOutExpo”)  
};  
Stage.addListener(myListener);

as the studio\_mc might be off stage when the browser is resized. Any ideas would be really helpful as I’m I bit of an AS numpty.
