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
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 ***//
}