# Cursor proximity testing

**URL:** <https://forum.kirupa.com/t/cursor-proximity-testing/186385>\
**Category:** Uncategorized\
**Created:** [April 20, 2006, 10:23pm UTC](https://forum.kirupa.com/t/cursor-proximity-testing/186385 "2006-04-20T22:23:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![willgoldstone7](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/willgoldstone7/32/2251_2.png) [@willgoldstone7](https://forum.kirupa.com/u/willgoldstone7)\
**Post date:** [April 20, 2006, 10:23pm UTC](https://forum.kirupa.com/t/cursor-proximity-testing/186385/1 "2006-04-20T22:23:39Z")

</div>

hi, i was wondering if anyone could help me test the proximity of the cursor to elements on the stage so that the returned figure can be used as a variable. for example the closer you get to something the larger it becomes.  
cheers.

---

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 20, 2006, 11:37pm UTC](https://forum.kirupa.com/t/cursor-proximity-testing/186385/2 "2006-04-20T23:37:38Z")

</div>

you can always get the distance between any2 points with the pythagorean theorum

Distance = squareRoot((x1-x2)^2 +(y1-y2)^2)

then all you have to do is manipulate what you do with that data

---

<div class="post-metadata">

**Author:** ![willgoldstone7](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/willgoldstone7/32/2251_2.png) [@willgoldstone7](https://forum.kirupa.com/u/willgoldstone7)\
**Post date:** [April 21, 2006, 12:14am UTC](https://forum.kirupa.com/t/cursor-proximity-testing/186385/3 "2006-04-21T00:14:15Z")

</div>

cheers, i take it in my case i would replace x1 with \_xmouse and x2 with object.\_x?

---

<div class="post-metadata">

**Author:** ![joran420](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joran420/32/2329_2.png) [@joran420](https://forum.kirupa.com/u/joran420)\
**Post date:** [April 21, 2006, 1:16am UTC](https://forum.kirupa.com/t/cursor-proximity-testing/186385/4 "2006-04-21T01:16:06Z")

</div>

yup
