|
-
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!
AS 2
-
Senior Member
Can you upload the FLA if possible so that we can check!
-
Last edited by Arsenkov; 04-04-2009 at 01:08 PM.
-
Senior Member
Which Flash version you use ?
-
Senior Member
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!
Last edited by vinayak.kadam; 02-08-2010 at 06:14 AM.
As ever,
Vinayak Kadam
-
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!
-
Senior Member
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!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|