# Following mouse pointer

**URL:** <https://forum.kirupa.com/t/following-mouse-pointer/118052>\
**Category:** Uncategorized\
**Created:** [August 2, 2004, 12:07pm UTC](https://forum.kirupa.com/t/following-mouse-pointer/118052 "2004-08-02T12:07:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Coolio](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@Coolio](https://forum.kirupa.com/u/Coolio)\
**Post date:** [August 2, 2004, 12:07pm UTC](https://forum.kirupa.com/t/following-mouse-pointer/118052/1 "2004-08-02T12:07:07Z")

</div>

okay 🙂 here goes…

well, i am working on my first real site 😛  
and i´ve already made the layout, i think its gd  
clear colours and so on…

BUT, i wanna add a little extra to the whole thing 🙂

so i was thinking about having a movieclip following the mouse pointer,  
and to make it perfect for the site, i thought about butterflies flapping their wings… just 2 butterflies 🙂

but as i am very new to everything, i dont really know what kinda script i need to make it follow the pointer, also, i want it to be with easing, so it doesnt just follow in a straight line

if anyone can help me with the script. i´ll be very happy 🙂

---

<div class="post-metadata">

**Author:** ![pom](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pom](https://forum.kirupa.com/u/pom)\
**Post date:** [August 2, 2004, 1:14pm UTC](https://forum.kirupa.com/t/following-mouse-pointer/118052/2 "2004-08-02T13:14:57Z")

</div>

There 🙂 [http://www.kirupa.com/developer/mx/followease.htm](http://www.kirupa.com/developer/mx/followease.htm)

---

<div class="post-metadata">

**Author:** ![Coolio](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@Coolio](https://forum.kirupa.com/u/Coolio)\
**Post date:** [August 2, 2004, 1:51pm UTC](https://forum.kirupa.com/t/following-mouse-pointer/118052/3 "2004-08-02T13:51:02Z")

</div>

thx a bunch :), but uhm… dumb question, but how do i make the clip staying a bit away from the pointer? so it doesnt move directly under the pointer, but stays like a centimeter away? something with the mouse x and y pos?

---

<div class="post-metadata">

**Author:** ![pom](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pom](https://forum.kirupa.com/u/pom)\
**Post date:** [August 2, 2004, 2:17pm UTC](https://forum.kirupa.com/t/following-mouse-pointer/118052/4 "2004-08-02T14:17:01Z")

</div>

```auto
onClipEvent (enterFrame) {
	endX = _root._xmouse + 5;
	endY = _root._ymouse - 10;
	_x += (endX-_x)/speed;
	_y += (endY-_y)/speed;
}[/As]
```

---

<div class="post-metadata">

**Author:** ![Coolio](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@Coolio](https://forum.kirupa.com/u/Coolio)\
**Post date:** [August 2, 2004, 2:48pm UTC](https://forum.kirupa.com/t/following-mouse-pointer/118052/5 "2004-08-02T14:48:46Z")

</div>

thx again

but i found out myself i think 😮

i edited the reg point, so that the butterfly is 1 cm left from the registration point 🙂

but that script works just as fine 😉

thx

i´ll post the site when its done 🙂
