-
hitTest
I made a movie clip follow the mouse, and when it collides with another movie clip, it should gotoAndPlay a frame. But it doesn't! My code is:
onClipEvent(enterFrame){
this._root._x=_xmouse;
this._root._y=_ymouse;
Mouse.hide();
if(this.hitTest(_root.ear)){
gotoAndPlay(3);
}
I even tried putting that code on a frame in the timeline, but it didn't work either. Nothing's happening when the movie clip that follows the mouse goes over the other movie clip "ear". HELP!:yikes:
AS 2
-
Can you upload the FLA if possible so that we can check!
-
-
Which Flash version you use ?
-
Hello there,
I managed to run your code and get the required functionality run. I made a few changes:
1. Moved the hand movie clip on top layer.
2. Moved the ear movie clip layer below above. I moved them on different layers so dept issues are taken care off.
3. Made some changes in the code in the hand movie clip.
I have attached the FLA which is saved in Flash 8. Hope this helps!
-
Thanks a lot!
Thanks man, I've been trying to get that working for quite some time now! Oh, and can you please tell me why'd you use that this.enterFrame=null thing, and when should I use it? (Cause I'm still a noob in Flash, so, yeah)
Thanks again,
Peace!
-
What enterframe does is it periodically, with some time interval, keeps on repeating what ever you have written in the even handler. So what ever code was written on the hand movie clip inside enterframe handler was called repeatedly with some interval.
Interval time is inversely proportional upon your frame rate. The more frame rate, the less interval and vice versa. Hope this helps!