# Mouse position on stage dictating volume level?

**URL:** <https://forum.kirupa.com/t/mouse-position-on-stage-dictating-volume-level/227504>\
**Category:** Uncategorized\
**Created:** [May 30, 2007, 9:22pm UTC](https://forum.kirupa.com/t/mouse-position-on-stage-dictating-volume-level/227504 "2007-05-30T21:22:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![camoconnell\_com](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/camoconnell_com/32/3655_2.png) [@camoconnell\_com](https://forum.kirupa.com/u/camoconnell_com)\
**Post date:** [May 30, 2007, 9:22pm UTC](https://forum.kirupa.com/t/mouse-position-on-stage-dictating-volume-level/227504/1 "2007-05-30T21:22:58Z")

</div>

Hello,

I’m wondering if someone could pls help me out with this, i’ve got a MC named ‘enterBtn’, i want the volume of ‘crowd.wav’ to increase when the mouse moves towards ‘enterBtn’ and decrease when moving away.

i don’t know if this helps, but the co-ordinates of enterBtn are x =530, y = 344.

I have had some help with the code already;

```auto
function volume() {

BtnCenterX = EnterBtn._x + (EnterBtn._width/2);
BtnCenterY = EnterBtn._y + (EnterBtn._height/2);

DistanceVert = _root._ymouse - BtnCenterY;
DistanceHor = _root._xmouse - BtnCenterX;

Distance = Math._root((DistanceHor * DistanceHor) + (DistanceVert * DistanceVert));

Volume = 100 / Distance;

};

```

but an error msg returns in the output;

> **Error** Scene=Scene 1, layer=actions, frame=126:Line 13: There is no method with the name ‘\_root’.  
> Distance = Math.\_root((DistanceHor \* DistanceHor) + (DistanceVert \* DistanceVert));

Total ActionScript Errors: 1 Reported Errors: 1

thanks  
Cam
