# Prob w/hittest\_example tut

**URL:** https://forum.kirupa.com/t/prob-w-hittest-example-tut/65842
**Category:** Uncategorized
**Created:** [September 30, 2004, 12:04am UTC](https://forum.kirupa.com/t/prob-w-hittest-example-tut/65842 "2004-09-30T00:04:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ballerina](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@ballerina](https://forum.kirupa.com/u/ballerina)
#### Post date: [September 30, 2004, 12:04am UTC](https://forum.kirupa.com/t/prob-w-hittest-example-tut/65842/1 "2004-09-30T00:04:14Z")

</div>

I am still a beginner with actionscript.

I got the hittest\_example.FLA and used some of the code on a frame in my movie.

[http://www.kirupa.com/developer/actionscript/hittest.htm](http://www.kirupa.com/developer/actionscript/hittest.htm)  
can’t get it to work right in my project. I am trying to make “laserbeam” bounce between “mirror” and “mirror2” when “mcShape1” hits “mcShape2”

laserbeam just keeps on going right. no bounce.

help me kind souls 😊  
I attached my FLA

---

<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: [September 30, 2004, 12:15am UTC](https://forum.kirupa.com/t/prob-w-hittest-example-tut/65842/2 "2004-09-30T00:15:35Z")

</div>

my first suggestion would be for you to repost in MX format 🙂

---

<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: [September 30, 2004, 1:36am UTC](https://forum.kirupa.com/t/prob-w-hittest-example-tut/65842/3 "2004-09-30T01:36:13Z")

</div>

The syntax of the last two if statements were incorrect. You also assigned the wrong number to the “number” variable in each of the if statements:

```auto
	if (laserbeam.hitTest(_root.mirror2)) {
		number = 2;
	}
	if (laserbeam.hitTest(_root.mirror)) {
		number = 1;
	}

```

---

<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: [October 1, 2004, 3:38pm UTC](https://forum.kirupa.com/t/prob-w-hittest-example-tut/65842/4 "2004-10-01T15:38:03Z")

</div>

Thanks folks! It works great now.

Lemme see if I understand…In the tut, the hittest was attached to the movieclip directly, therefore “this” was used, with a comma and space. I assume “this” refers to the mc. The syntax is different in this case? No fun for a begginer to figure this out. Oh well.

The number asssignment was a stupid mistake…overtired.

valpez1–is the scripting I’m using out of date or something or did I just post in the wrong forum?

thanks again 😃

---

<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: [October 1, 2004, 7:09pm UTC](https://forum.kirupa.com/t/prob-w-hittest-example-tut/65842/5 "2004-10-01T19:09:48Z")

</div>

I just suggested reposting in MX format because some users, like myself, only have MX, not 2004 MX. And it’d be easier to help you out.  
But, you ended up getting help anyway, so hooray! 🙂

And yes, the **this** in the code always refers to mc it is attached to, or if you are using a function, the function it is accompanied with.

take care
