# attachMovie not working!

**URL:** <https://forum.kirupa.com/t/attachmovie-not-working/323263>\
**Category:** flash\
**Created:** [June 22, 2011, 9:35pm UTC](https://forum.kirupa.com/t/attachmovie-not-working/323263 "2011-06-22T21:35:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NuclearTeddies](https://avatars.discourse-cdn.com/v4/letter/n/839c29/32.png) [@NuclearTeddies](https://forum.kirupa.com/u/NuclearTeddies)\
**Post date:** [June 22, 2011, 9:35pm UTC](https://forum.kirupa.com/t/attachmovie-not-working/323263/1 "2011-06-22T21:35:19Z")

</div>

So my code is failing pretty hard. I’m trying to build a little tile editor for a game I’m about to make, but in setting up the tiles on the screen something goes wrong.  
Here’s the code:

```auto

for (j = 0; j < _root.mapHeight; j++)
{
    for (i = 0; i < _root.mapWidth; i++)
    {
        var newname:String = "tile" + i + "x" + j + "y";
        var newTile:MovieClip = _root.attachMovie("mcTileInt", newname, _root.makeDepth);
        newTile._x = (i * _root.tileWidth) + _root.editorOffsetX;
        newTile._y = (j * _root.tileHeight) + _root.editorOffsetY;
        trace(newTile);
        _root.makeDepth += 1;
    }
}
stop();

```

the trace just spits a whole bunch of 'undefined’s at me.  
I double checked the variables once again just to be sure, and they’re all right.  
Hope one of you can help me fix this 🙂

Solved, forgot exporting the movieclip for actionscript.
