# Mouse Following

**URL:** <https://forum.kirupa.com/t/mouse-following/40538>\
**Category:** flash\
**Created:** [January 19, 2004, 7:40pm UTC](https://forum.kirupa.com/t/mouse-following/40538 "2004-01-19T19:40:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhargrave](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@jhargrave](https://forum.kirupa.com/u/jhargrave)\
**Post date:** [January 19, 2004, 7:40pm UTC](https://forum.kirupa.com/t/mouse-following/40538/1 "2004-01-19T19:40:07Z")

</div>

I am loading an external .swf into another. This (loaded) .swf is employing a mouse-following technique from one of lostinbeta’s tutorials, using the following script:

onClipEvent (enterFrame) {  
endX = \_root.\_xmouse;  
endY = \_root.\_ymouse;  
\_x += (endX-\_x)/speed;  
\_y += (endY-\_y)/speed;  
}

Everything works great, except the .swf I am loading is only 400x400 pixels and my overall movie is 600x800. I only want the mouse follow to take place if the mouse is over the smaller (400x400) .swf, not anywhere else on the screen.

I’m sure there is a simple way to make this happen, but I cannot think of it.

Thanks in advance.
