# Strange resize problem

**URL:** <https://forum.kirupa.com/t/strange-resize-problem/311403>\
**Category:** flash\
**Created:** [July 6, 2010, 12:46am UTC](https://forum.kirupa.com/t/strange-resize-problem/311403 "2010-07-06T00:46:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daidai](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daidai/32/3087_2.png) [@daidai](https://forum.kirupa.com/u/daidai)\
**Post date:** [July 6, 2010, 12:46am UTC](https://forum.kirupa.com/t/strange-resize-problem/311403/1 "2010-07-06T00:46:17Z")

</div>

Now, I hope this is me just needing more coffee and I hope to be embarrassed by my stupidly, but:

I have made a little example to show my problem

It is a red square, which resizes to the dimensions of the stage. Simple no, but no because it doesnt seem to work properly, moving out of place and acting weird. Please simple problem is driving me nuts

```php

var sq = new Shape();
sq.graphics.beginFill(0xFF0000)
sq.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
sq.graphics.endFill();
addChild(sq);

stage.addEventListener(Event.RESIZE, onResizeHandler);
			
function onResizeHandler(event:Event):void
{
	trace("stage width = "+stage.stageWidth);
	trace("stage height = "+stage.stageHeight);
	
	sq.x = 0;
	sq.y = 0;
	sq.width = stage.stageWidth;
	sq.height = stage.stageHeight;
	
	trace("sq width = "+sq.width);
	trace("sq height = "+sq.height+"
");
}

```

thanks  
:drink:
