# Tile background problem

**URL:** <https://forum.kirupa.com/t/tile-background-problem/294254>\
**Category:** Uncategorized\
**Created:** [August 11, 2009, 2:11pm UTC](https://forum.kirupa.com/t/tile-background-problem/294254 "2009-08-11T14:11:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bealox](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@bealox](https://forum.kirupa.com/u/bealox)\
**Post date:** [August 11, 2009, 2:11pm UTC](https://forum.kirupa.com/t/tile-background-problem/294254/1 "2009-08-11T14:11:41Z")

</div>

Hi Guys

i have tried to do tile background, and I also created a listener so it can fit in any screen but somehow it doesn’t really work when I resize the window.

can anyone tell me the reason?  
Thanks

stop();  
Stage.scaleMode = “noscale”;  
Stage.align = “tl”;

sizeListener = new Object();  
sizeListener.onResize = doResize;  
Stage.addListener({onResize:doResize});

function doResize() {  
tile\_width = 34;  
tile\_height = 34;  
//  
x\_max = Math.round(Stage.width/tile\_width);  
y\_max = Math.round(Stage.height/tile\_height);  
trace(x\_max);  
trace(y\_max);  
for (x=0; x\<x\_max; x++) {  
for (y=0; y\<y\_max; y++) {  
bg = \_root.attachMovie(“square”, “bg”+x+y, this.getNextHighestDepth());  
bg.\_x = tile\_width_x;  
bg.\_y = tile\_height_y;  
}  
}  
};  
Stage.addListener(sizeListener);  
doResize();
