# Issue with constant function calls from MouseEvent.MOUSE\_DOWN

**URL:** <https://forum.kirupa.com/t/issue-with-constant-function-calls-from-mouseevent-mouse-down/317665>\
**Category:** flash\
**Created:** [December 29, 2010, 9:26am UTC](https://forum.kirupa.com/t/issue-with-constant-function-calls-from-mouseevent-mouse-down/317665 "2010-12-29T09:26:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaxz](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jaxz](https://forum.kirupa.com/u/jaxz)\
**Post date:** [December 29, 2010, 9:26am UTC](https://forum.kirupa.com/t/issue-with-constant-function-calls-from-mouseevent-mouse-down/317665/1 "2010-12-29T09:26:47Z")

</div>

**Issue with constant function calls from MouseEvent.MOUSE\_DOWN**

Me again - just discovered that my volume slider function (triggered by MouseEvent.MOUSE\_DOWN) seem to constantly call the adjustVolume function. Never noticed until I put a trace in the adjVol func.

Issue - My slider below seems to keep calling the target function and never stops once an initial slider drag has been done. Thus the “stopDragging” (MouseEvent.MOUSE\_UP) function does not seem to bite.  
PLS advice!

/Jaxz

```auto

var rectangle:Rectangle = new Rectangle(0,0,100,0);  
var dragging:Boolean = false;
var bounds:Object = {left:0, right:100};

volPercent.selectable = false;
volPercent.autoSize = "center";

volume_mc.mySlider_mc.addEventListener(MouseEvent.MOUSE_DOWN, startDragging,false, 0, true);

function startDragging(event:Event):void 
{
	volume_mc.mySlider_mc.startDrag(false,rectangle);
	dragging = true;
	volume_mc.mySlider_mc.addEventListener(Event.ENTER_FRAME, adjustVolume,false, 0, true);
}

stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging,false, 0, true);

function stopDragging(event:Event):void {
	if (dragging) {
		dragging = false;
		volume_mc.mySlider_mc.stopDrag();
	}
	volPercent.text = Math.round((volume_mc.mySlider_mc.x-bounds.left)/(bounds.right-bounds.left)*100) + "%";
	}
}

function adjustVolume(event:Event):void 
{	
	Vol = volume_mc.mySlider_mc.x / 100;
	
	// lots of volume adjustments with SCs and soundTransforms ***//
}

```
