# Tiles from Arrays Help

**URL:** https://forum.kirupa.com/t/tiles-from-arrays-help/305295
**Category:** flash
**Created:** [February 23, 2010, 1:08am UTC](https://forum.kirupa.com/t/tiles-from-arrays-help/305295 "2010-02-23T01:08:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![MossyStump](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@MossyStump](https://forum.kirupa.com/u/MossyStump)
#### Post date: [February 23, 2010, 1:08am UTC](https://forum.kirupa.com/t/tiles-from-arrays-help/305295/1 "2010-02-23T01:08:47Z")

</div>

I have returned form the depths of nowhere in particular to once again, seek ActionScript help 😃

(if anyone even remembers me, I wasn’t about long ;-;

ANYWHO.  
Seeking some help with a little tile-based program I’m whipping up.  
Currently just running a few tests to see if I can get the basics of the system I would like to create to work (which it doesn’t, which is why I’m here in the firstplace :D)  
ANYWAY.  
currently, it works… sorta… but it only works for the last tile in the array =/ any help?

Lets see if I remember how to do this…

```auto

var depth = _root.getNextHighestDepth();
desert = new Array("brick", "sand", "brick", "sand");

onLoad = function(){
loadMap();
}

loadMap = function () {
        var tileX:Number = 0;
        var tileY:Number = 0;
        var tile:String;
        for (z=0; z<desert.length;z++) {
            tile = desert[z];
            trace(tile);
            _root.attachMovie(tile,tile,depth);
            _root[tile]._x = tileX;
            _root[tile]._y = tileY;
            tileX += 30;
            trace(tileX);
        }
    };

```
