|
-
Flashkit Witch
I want to create a button/graphic/mc that moves away if the cursor goes near it, as if repelled/being chased by the cursor. How do I do this?
-
this may be something like what you're looking for its a movieclip event handler - of course.
Code:
onClipEvent(enterFrame){
dx=_root._xmouse-this._x;
dy=_root._ymouse-this._y;
od=Math.sqrt((dx*dx)+(dy*dy));
if (od<300){
this._x=this._x+(od/30);
this._y=this._y+(od/30);
}
}
this should provide you with a bit of inspiration for your particular assignment.
-
Flashkit Witch
thanks, I will try it.
-
Flashkit Witch
Okay, how do I stop it from moving out of the screen? Also, how do I get it to move in all directions instead of just one?
-
Infinite Loop
Hello,
Only looked at this for a short while,not sure exactly what your shooting for, but maybe something like this............
onClipEvent (enterFrame) {
xdif = _x-_root._xmouse;
ydif = _y-_root._ymouse;
_x -=- xdif/10;
_y -= -ydif/10;
}
Hope it helps
Regards
~GD~
-
Flashkit Witch
Thanks, How do I stop it from leaving the screen? And, can I make the movements more jerky? I want it to be absolutely 100% unclickable... so that the cursor simply cannot touch the button/mc.
-
Flashkit Witch
-
Infinite Loop
Hi again,
Sorry, got a little side tracked on a few things. Here is an fla you might want to take a look at, attatch one of the MC's to the mouse pointer and set the visibility to false ( or alpha to 0) and it should do just what you were asking.............
http://caveart.tv/magnetism2.fla
Hope it helps
Regards
~GD~
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
|