Prob w/hittest_example tut

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
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 :blush:
I attached my FLA

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

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:

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

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 :smiley:

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! :slight_smile:

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