# Resizing a movieclip to stage

**URL:** <https://forum.kirupa.com/t/resizing-a-movieclip-to-stage/310328>\
**Category:** Uncategorized\
**Created:** [June 7, 2010, 8:03pm UTC](https://forum.kirupa.com/t/resizing-a-movieclip-to-stage/310328 "2010-06-07T20:03:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelafoley](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@michaelafoley](https://forum.kirupa.com/u/michaelafoley)\
**Post date:** [June 7, 2010, 8:03pm UTC](https://forum.kirupa.com/t/resizing-a-movieclip-to-stage/310328/1 "2010-06-07T20:03:46Z")

</div>

Hello all,  
I have a movieclip that i want to resize to fit the stage and center it with a button click. Then resize back to it’s original size and place with a second button. my code needs help, but what am i doing wrong? I want to use this mc to play video full screen or normal.

Code:  
import flash.display.StageAlign;  
import flash.display.StageScaleMode;

size\_btn.addEventListener(MouseEvent.CLICK, resizeHandler);

function resizeHandler(e:Event):void  
{

my\_mc.x = (my\_mc.stage.stageWidth / 2) - (my\_mc.width / 2);  
my\_mc.y = (my\_mc.stage.stageHeight / 2) - (my\_mc.height / 2);

var newHeight=my\_mc.height/my\_mc.width;  
var newWidth=my\_mc.width/my\_mc.height;

if((stage.stageHeight/stage.stageWidth)\<newHeight)  
{  
my\_mc.width=stage.stageWidth;  
my\_mc.height=newHeight_my\_mc.width;  
}  
else  
{  
my\_mc.height=stage.stageHeight;  
my\_mc.width=newWidth_my\_mc.height;

stage.align = StageAlign.TOP\_LEFT;  
stage.scaleMode = StageScaleMode.SHOW\_ALL;  
stage.dispatchEvent(new Event(Event.RESIZE));  
trace (“hello”);  
}

}

small\_btn.addEventListener(MouseEvent.CLICK, resizeFsHandler);  
function resizeFsHandler(e:Event):void  
{  
my\_mc.x = stage.stageWidth-my\_mc.width, stage.stageHeight-my\_mc.height;  
my\_mc.y = stage.stageHeight-my\_mc.height, stage.stageWidth-my\_mc.width;  
stage.dispatchEvent(new Event(Event.RESIZE));  
trace (“goodbye”);

}
