# Trouble with code generated tile

**URL:** <https://forum.kirupa.com/t/trouble-with-code-generated-tile/210204>\
**Category:** flash\
**Created:** [December 16, 2006, 2:36am UTC](https://forum.kirupa.com/t/trouble-with-code-generated-tile/210204 "2006-12-16T02:36:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [December 16, 2006, 2:36am UTC](https://forum.kirupa.com/t/trouble-with-code-generated-tile/210204/1 "2006-12-16T02:36:23Z")

</div>

Trying to make a simple tile with the drawing API, but it is doing some weird stuff and looks bad, any ideas?

```auto
_global.tileBG = function () {
    createEmptyMovieClip("tile", 400)
    with(tile){
        lineStyle(1, 0xCC0066, 100, false, "none", "none", "miter", 1);
        moveTo(1, 1);
        lineTo(1, 1);
        moveTo(6,1)
        lineTo(1, 6);
        moveTo(2,7)
        lineTo(7, 2);
        moveTo(7,7)
        lineTo(7, 7);
        lineStyle(1, 0x660033, 100, false, "none", "none", "miter", 1);
        moveTo(2, 1);
        lineTo(1, 2);
        moveTo(5,1)
        lineTo(1, 5);
        moveTo(3,7)
        lineTo(7, 3);
        moveTo(6,7)
        lineTo(7, 6);
        lineStyle(1, 0xFF0099, 100, false, "none", "none", "miter", 1);
        moveTo(7, 1);
        lineTo(1, 7);
        lineStyle(1, 0x000000, 100, false, "none", "none", "miter", 1);
        moveTo(3, 1);
        lineTo(1, 3);
        moveTo(4,1)
        lineTo(1, 4);
        moveTo(4,7)
        lineTo(7, 4);
        moveTo(5,7)
        lineTo(7, 5);
    }
    x_max = Math.round(Stage.width/5);
    y_max = Math.round(Stage.height/5);
    var i:Number = 0;
    for (x=0; x<=x_max; x++) {
        for (y=0; y<=y_max; y++) {
            bg = tile.duplicateMovieClip("tile"+x+y, i)
            bg._x = 6*x;
            bg._y = 6*y;
            i++;
        }
    }
};
tileBG();

```

[http://www.JoshuaJonah.com/tile.swf](http://www.JoshuaJonah.com/tile.swf)  
[http://www.JoshuaJonah.com/tile.fla](http://www.JoshuaJonah.com/tile.fla)
