# Full Browser not working with addChild

**URL:** <https://forum.kirupa.com/t/full-browser-not-working-with-addchild/295490>\
**Category:** flash\
**Created:** [August 31, 2009, 11:04am UTC](https://forum.kirupa.com/t/full-browser-not-working-with-addchild/295490 "2009-08-31T11:04:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttmt](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@ttmt](https://forum.kirupa.com/u/ttmt)\
**Post date:** [August 31, 2009, 11:04am UTC](https://forum.kirupa.com/t/full-browser-not-working-with-addchild/295490/1 "2009-08-31T11:04:35Z")

</div>

Full Browser not working with addChild

Hi all

I’m working on a full browser site - it has 3 MovieClips, header\_mc, body\_mc and footer\_mc.

When the browser resizes, the header and footer stay the same height and the body height changes.

It’s all working fine when I have the MovieClips on the stage and named.

[http://www.ttmt.org.uk/imgScale/1/](http://www.ttmt.org.uk/imgScale/1/)

```auto

stage.scaleMode=StageScaleMode.NO_SCALE;
stage.align=StageAlign.TOP_LEFT;
//
//--Page Structure------------------------

var footerH:Number=170;
var headerFooterH:Number=250;

stage.addEventListener(Event.RESIZE, stage_resizeHandler);

function stage_resizeHandler(evt:Event):void {
	resizeWindow();
}

function resizeWindow() {
	var stageW:Number=stage.stageWidth;
	var stageH:Number=stage.stageHeight;
	header_mc.width=body_mc.width=footer_mc.width=stageW;
	body_mc.height=stageH-headerFooterH;
	footer_mc.y=stageH-footerH;
}

```

But if I try to add the MovieClip at run time it doesn’t work - does anyone know or see why it won’t work.

[http://www.ttmt.org.uk/imgScale/2/](http://www.ttmt.org.uk/imgScale/2/)

```auto

stage.scaleMode=StageScaleMode.NO_SCALE;
stage.align=StageAlign.TOP_LEFT;
//
//--Page Structure------------------------
var header_mc:MovieClip = new MovieClip();
var body_mc:MovieClip = new MovieClip();
var footer_mc:MovieClip = new MovieClip();
//
var pageW:Number=1670;
var headH:Number=80;
var bodyH:Number=700;
var footerH:Number=170;
var headerFooterH:Number=250;
//
function createStructure(clip, col, xpos, ypox, wid, het):void {
	clip.graphics.beginFill(col);
	clip.graphics.drawRect(xpos,ypox,wid,het);
	clip.graphics.endFill();
	addChild(clip);
}
//
createStructure(header_mc, 0x009999,0,0,pageW, headH);
createStructure(body_mc, 0x8C650D,0,80,pageW, bodyH);
createStructure(footer_mc, 0x12871E,0,780,pageW, footerH);
//
stage.addEventListener(Event.RESIZE, stage_resizeHandler);

function stage_resizeHandler(evt:Event):void {
	resizeWindow();
}

function resizeWindow() {
	var stageW:Number=stage.stageWidth;
	var stageH:Number=stage.stageHeight;
	header_mc.width=body_mc.width=footer_mc.width=stageW;
	body_mc.height=stageH-headerFooterH;
	footer_mc.y=stageH-footerH;
}

```
