# Resize background image to browser in scale

**URL:** https://forum.kirupa.com/t/resize-background-image-to-browser-in-scale/227496
**Category:** flash
**Created:** [May 30, 2007, 7:17pm UTC](https://forum.kirupa.com/t/resize-background-image-to-browser-in-scale/227496 "2007-05-30T19:17:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![luckypp](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@luckypp](https://forum.kirupa.com/u/luckypp)
#### Post date: [May 30, 2007, 7:17pm UTC](https://forum.kirupa.com/t/resize-background-image-to-browser-in-scale/227496/1 "2007-05-30T19:17:10Z")

</div>

I am hoping that someone can give me a hand with something.

I am trying to achieve an effect seen as on this website. [www.viaduct.com](http://www.viaduct.com)

I want to have a background image that resizes to the browser window (my other elements retaining their size) - but stays in scale. I have been using the code provided at gotoandlearn which tiles the image. Here is the code used there.

import flash.display.BitmapData;

GreyBar.\_xscale = Stage.width;

var tile:BitmapData = BitmapData.loadBitmap(“tile”);

function fillBG() {  
this.beginBitmapFill(tile);  
this.lineTo(0,0);  
this.lineTo(Stage.width,0);  
this.lineTo(Stage.width,Stage.height);  
this.lineTo(0,Stage.height);  
this.lineTo(0,0);  
this.endFill();  
}

fillBG();

var stageL:Object = new Object();  
stageL.onResize = function() {  
fillBG();  
GreyBar.\_xscale = Stage.width;  
}

Stage.addListener(stageL);

Can anyone take me the rest of the way - or point me to a tutorial that will help me get there?

Thanks
