View Full Version : Hittest inside of a movieclip

02-25-2010, 11:48 PM
I am trying to create a hittest inside of a movieclip and it doesn't work, can anyone tell me a solution and explain why this occurs.

Here is the code.
I've used this code outside of a movieclip and it worked.

onClipEvent (enterFrame) {
this._x -= 3;
if (this.hitTest(_root.Timer_End) == true) {
this._x += 3;

I thank you in advance.

Also, I know how to make a normal timer so don't explain that to me, I wanted to create a graphic one for this test.

02-26-2010, 12:22 AM
"this" refers to the movieclip the the object is in, not the object itself (it refers to the _parent object rather the nestled one). While I haven't coded in ages, you might be able to solve this by changing all the




While the above may not work, the reason you have this problem is due to referencing problems. If you don't mind giving your object inside the movieclip and instance name like "hit_object" or something, then you could use


02-26-2010, 05:32 AM
I've tried your solution with no luck, I would like to thank you for explaining my problem to me.

02-26-2010, 07:14 AM
"_root.parent instance name.child instance name" if you want to refer a MovieClip within another MovieClip.

Bonk is perfectly right the way I read it. "this." refers to the clip the script is in, nothing inside it specifically just everything that is.makes up the clip, ie, the clip selected when you were typing in the AS box it what it will apply to.

02-26-2010, 02:13 PM
Oh, I read the post incorrectly... lol, thank you all.