# Collision Problems

**URL:** <https://forum.kirupa.com/t/collision-problems/262303>\
**Category:** flash\
**Created:** [June 4, 2008, 8:31pm UTC](https://forum.kirupa.com/t/collision-problems/262303 "2008-06-04T20:31:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tkunze](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tkunze](https://forum.kirupa.com/u/tkunze)\
**Post date:** [June 4, 2008, 8:31pm UTC](https://forum.kirupa.com/t/collision-problems/262303/1 "2008-06-04T20:31:14Z")

</div>

Okay, i have my programming set up so that if two objects collide it will go to a different frame. The piece of code is below.

```auto
 onClipEvent (enterFrame) {
        if (_root.A-17, hitTest(_root.alien_fighter)) {
              _root.

        } else {
              ;
        }
    }

```

But instead of waiting for collision to happen it goes to another frame right away, i think its because of this piece of coding.

```auto
onClipEvent (enterFrame) {

```

i think i need to change the (enterFrame) to something else so it won’t just gotoAndPlay (3); like it usually does, any help would be wonderful!!

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [June 4, 2008, 9:56pm UTC](https://forum.kirupa.com/t/collision-problems/262303/2 "2008-06-04T21:56:28Z")

</div>

can you repost your code please - im pretty sure you missed parts

also - your problem is likely here if (\_root.A-17, hitTest(\_root.alien\_fighter)) - that doesnt seem like a valid condition to me…

---

<div class="post-metadata">

**Author:** ![tkunze](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tkunze](https://forum.kirupa.com/u/tkunze)\
**Post date:** [June 4, 2008, 10:00pm UTC](https://forum.kirupa.com/t/collision-problems/262303/3 "2008-06-04T22:00:58Z")

</div>

i got the code from this kirupa tutorial [http://www.kirupa.com/developer/actionscript/hittest.htm](http://www.kirupa.com/developer/actionscript/hittest.htm)

granted that tutorial was for flash 5, i believe it should still work here should it not?

---

<div class="post-metadata">

**Author:** ![cooldude88](https://avatars.discourse-cdn.com/v4/letter/c/e0b2c6/32.png) [@cooldude88](https://forum.kirupa.com/u/cooldude88)\
**Post date:** [June 4, 2008, 10:08pm UTC](https://forum.kirupa.com/t/collision-problems/262303/4 "2008-06-04T22:08:55Z")

</div>

im not sure about the rest of the code i dont really have time right now to comb through it but if its going to the next frame right away try putting stop(); in the frame and also using gotoAndStop(frame); instead of gotoAndPlay(frame);  
🍺

---

<div class="post-metadata">

**Author:** ![tkunze](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tkunze](https://forum.kirupa.com/u/tkunze)\
**Post date:** [June 4, 2008, 10:59pm UTC](https://forum.kirupa.com/t/collision-problems/262303/5 "2008-06-04T22:59:54Z")

</div>

okay… not sure that will work cause here is my exact reason for needing the collision. I have a aircraft image, that when you press up it goes up, down it goes down, and so on. So unless you press and arrow key it doesn’t go anywhere, i have another object (on the otherside of the flash file, so there not touching) that when you move the aircraft to the other object it will go to that frame, but its not doing that for some reason, its justs automatcially going to the frame for (If there is a collision)
