# Quick question on hitTest

**URL:** <https://forum.kirupa.com/t/quick-question-on-hittest/29265>\
**Category:** Uncategorized\
**Created:** [August 25, 2003, 3:31am UTC](https://forum.kirupa.com/t/quick-question-on-hittest/29265 "2003-08-25T03:31:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gwocker](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@Gwocker](https://forum.kirupa.com/u/Gwocker)\
**Post date:** [August 25, 2003, 3:31am UTC](https://forum.kirupa.com/t/quick-question-on-hittest/29265/1 "2003-08-25T03:31:35Z")

</div>

When I use hitTest, there’s a limited number of commands I can use. For example, if I want to Go To and Play the next scene as soon as a collision is detected, I’d enter GoToandPlay yadda yadda right under the hitTest command, but when there’s a collision, nothing will happen. I’m relatively new to actionscript, so forgive me if I sound stupid, but am I doing something wrong? If I can, how would I get hitTest to go to and play another scene? Thanks in advance for any help…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2003, 4:08am UTC](https://forum.kirupa.com/t/quick-question-on-hittest/29265/2 "2003-08-25T04:08:29Z")

</div>

Welcome to kirupa forum, Gwocker! =)

Could you post your code so I can see what’s wrong? 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2003, 4:37am UTC](https://forum.kirupa.com/t/quick-question-on-hittest/29265/3 "2003-08-25T04:37:34Z")

</div>

[AS]onClipEvent (load) {  
if (\_root.lan, hitTest(\_root.enemy1)) {  
gotoAndPlay (3);  
}  
}[/AS]  
That’s the command I’m using… And as I understand, the action should make the clip play the third frame, but nothing’s happening.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2003, 4:40am UTC](https://forum.kirupa.com/t/quick-question-on-hittest/29265/4 "2003-08-25T04:40:15Z")

</div>

Try this one… 😉  
[AS]onClipEvent (load) {  
if (\_root.lan.hitTest(\_root.enemy1)) {  
gotoAndPlay(3);  
}  
}[/AS]  
I edited your post to format the code properly, you can do this by using [**AS][**/AS] tags. Please use them next time, thank you. =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2003, 4:50am UTC](https://forum.kirupa.com/t/quick-question-on-hittest/29265/5 "2003-08-25T04:50:01Z")

</div>

Thanks, but there’s still a problem… the code still doesn’t work \>.\<. Any other suggestions you think might help?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2003, 4:59am UTC](https://forum.kirupa.com/t/quick-question-on-hittest/29265/6 "2003-08-25T04:59:21Z")

</div>

use enterFrame instead of load for the clipEvent

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2003, 5:00am UTC](https://forum.kirupa.com/t/quick-question-on-hittest/29265/7 "2003-08-25T05:00:54Z")

</div>

Ok… it must be an addressing problem.

Althought it would be easier for me if you could attach your FLA… I’ll take a shot in the dark. 😛  
[AS]onClipEvent (load) {  
if (\_root.lan.hitTest(\_root.enemy1)) {  
\_root.gotoAndPlay(3);  
}  
}[/AS]  
[EDIT]So true, rysolag! How could I not see it!? :P[/EDIT]
