# attachMovie Problem!

**URL:** https://forum.kirupa.com/t/attachmovie-problem/251800
**Category:** flash
**Created:** [February 12, 2008, 8:18pm UTC](https://forum.kirupa.com/t/attachmovie-problem/251800 "2008-02-12T20:18:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![username373](https://avatars.discourse-cdn.com/v4/letter/u/f9ae1b/32.png) [@username373](https://forum.kirupa.com/u/username373)
#### Post date: [February 12, 2008, 8:18pm UTC](https://forum.kirupa.com/t/attachmovie-problem/251800/1 "2008-02-12T20:18:09Z")

</div>

I have a little game I’m making for school, and one of my attachMovie lines is not working. I added a line to test if the movieClip is was attached and it returns NULL. I have tried everything in my knowledge and need help please.

This is the code to fire the bullet:

```auto

function onMouseDown() {
    h++;
    angle = turret._rotation-1;
    bullet_x = turret._x+48*Math.cos(angle*Math.PI/180);
    bullet_y = turret._y+48*Math.sin(angle*Math.PI/180);
    var bulletN = "bullet"+h;
    _root.attachMovie("bullet", bulletN, _root.getNextHighestDepth(), {_x:bullet_x, _y:bullet_y});
    if (_root[bulletN] == NULL) {
        trace("The bullet wasn't created!");
    }
    _root[bulletN].dirx = Math.cos(angle*Math.PI/180)*firepower;
    _root[bulletN].diry = Math.sin(angle*Math.PI/180)*firepower;
    _root[bulletN].onEnterFrame = function() {
        this._x += 50;
        this._y += 50;
    };
}

```

My hunch is something is wrong with this line:

```auto
_root.attachMovie("bullet", bulletN, _root.getNextHighestDepth(), {_x:bullet_x, _y:bullet_y});

```

Any help is welcome! Thanks!
