# Tiling a background with 100% SWF

**URL:** <https://forum.kirupa.com/t/tiling-a-background-with-100-swf/161190>\
**Category:** flash\
**Created:** [September 1, 2005, 5:35pm UTC](https://forum.kirupa.com/t/tiling-a-background-with-100-swf/161190 "2005-09-01T17:35:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamiehunter](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jamiehunter](https://forum.kirupa.com/u/jamiehunter)\
**Post date:** [September 1, 2005, 5:35pm UTC](https://forum.kirupa.com/t/tiling-a-background-with-100-swf/161190/1 "2005-09-01T17:35:57Z")

</div>

I am using this code to create a tiled background on a site I’m working on.

tileBG = function () {

tile\_width = 128;  
tile\_height = 128;  
//  
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;

}

}

};  
tileBG();

It works great, but because I’m publishing my SWF with noScale at 100% width and height, the background doesnt fill the whole swf, only the size of the actual stage in the FLA. Is there any way I can change this so It will fit accordingly?  
Thanks  
Jamie
