rondog
12-18-2008, 11:12 PM
I am trying to make a volume slider and I cant seem to get it to work when the user clicks, holds and drags. It works as long as your mouse is inside the movieclip, but anywhere else it just freezes. Look here to see what I am talking about: http://ronnieswietek.com/hosted/flvplayer/test.html
Here is my code that handles when the user interacts with that volume slider:
controls.volmc.addEventListener(MouseEvent.MOUSE_D OWN, startDragging);
controls.volmc.addEventListener(MouseEvent.MOUSE_U P, stopDragging);
private function startDragging(e:MouseEvent):void
{
controls.volmc.addEventListener(MouseEvent.MOUSE_M OVE, updateVolBySlide);
var pct:Number = e.localX / volWidth;
volBar.width = e.localX;
}
private function stopDragging(e:MouseEvent):void
{
controls.volmc.removeEventListener(MouseEvent.MOUS E_MOVE, updateVolBySlide);
}
private function updateVolBySlide(e:MouseEvent):void
{
volBar.width = e.localX;
}
Here is my code that handles when the user interacts with that volume slider:
controls.volmc.addEventListener(MouseEvent.MOUSE_D OWN, startDragging);
controls.volmc.addEventListener(MouseEvent.MOUSE_U P, stopDragging);
private function startDragging(e:MouseEvent):void
{
controls.volmc.addEventListener(MouseEvent.MOUSE_M OVE, updateVolBySlide);
var pct:Number = e.localX / volWidth;
volBar.width = e.localX;
}
private function stopDragging(e:MouseEvent):void
{
controls.volmc.removeEventListener(MouseEvent.MOUS E_MOVE, updateVolBySlide);
}
private function updateVolBySlide(e:MouseEvent):void
{
volBar.width = e.localX;
}