# Attach movieclip problem

**URL:** <https://forum.kirupa.com/t/attach-movieclip-problem/243093>\
**Category:** Uncategorized\
**Created:** [November 2, 2007, 6:15pm UTC](https://forum.kirupa.com/t/attach-movieclip-problem/243093 "2007-11-02T18:15:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![leonthelion](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@leonthelion](https://forum.kirupa.com/u/leonthelion)\
**Post date:** [November 2, 2007, 6:15pm UTC](https://forum.kirupa.com/t/attach-movieclip-problem/243093/1 "2007-11-02T18:15:19Z")

</div>

I’ve been playing around with the attach movie code but I’m having a problem, I have two attach movie codes on one frame. Theres one for explosion and one for bullets. For some reason the explosion keeps dissapearing and coming back in a different place when its not supposed to. Also the animation for the explosion just goes back to where it was right before it moved. I do know the errors in here somewhere (really long):

```php
 
explosionNum = 0;
function newEnemy() {
    attachMovie("explosion","explosion"+explosionNum,explosionNum+1);
      var explosion = eval("explosion"+explosionNum); 
   explosionNum++;
 
    explosion._x = Math.random()*(500-50)+50;
    explosion._y = Math.random()*(350-50)+50;
 
    explosion.onEnterFrame = function() {
        explosion.x = explosion._x;
        explosion.y = explosion._y;
 
    };
}
newEnemyInt = setInterval(newEnemy, 1000+random(500));
 
bulletNum = 0;
function newEnemy2() {
    attachMovie("bullet","bullet"+bulletNum,bulletNum+1);
 
      var bullet = eval("bullet"+bulletNum); 
 
   bulletNum++;
 
    bullet._x = Math.random()*(500-50)+50;
    bullet._y = Math.random()*(350-50)+50;
 
 bullet.onEnterFrame = function() {
        bullet.x = bullet._x;
        bullet.y = bullet._y;
    };
}
newEnemy2Int = setInterval(newEnemy2, 1000+random(500));

```

Thanks 🙂
