I'm making a custom slider component. The head (the thing that you drag) is programmed like this:
head.addEventListener(MouseEvent.MOUSE_DOWN, function():void {
head.startDrag(false, new Rectangle(stubDiv,0,width - stubDiv - ((levels-maxLevel)*stubDiv),0));
});
head.addEventListener(MouseEvent.MOUSE_MOVE, function():void {
updateLevel();
});
head.addEventListener(MouseEvent.MOUSE_UP, function():void {
head.stopDrag();
setHeadPos();
});
Because the head is constrained to the area of the slider bar, the mouse can move away from it. If that happens, the object is still being dragged, but it doesn't receive MOUSE_MOVE
events, nor the MOUSE_UP
event if the mouse is released.
What's the best solution?