Scrollfunction - "pushing" button when releasing mouse from scrolling
I have a scrollfunction on a container(MovieClip). The container has a instance of several buttons(other movieclips). When I scroll the container and release the mouse I automatically push the button where the mouse release the scroll. If that was understandable.
I scroll, when I release the scroll. One of the buttons is pushed.
I have tried adding a if sentence with the "offsetY" like this:
//if(offsetY>30 || offsetY<-30)
I have tried adding a timer in the mouseUpHandler, without success.
container.addEventListener(MouseEvent.CLICK, onMouse); // This is the code that is triggered.
var maxY: Number = 0;
var minY: Number = Math.min(0, stage.stageHeight - container.height - mcTopic.height - blaatt.height - controlButtons.height - mcNowPlaying.height);
var _startY: Number;
var _startMouseY: Number;
addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event: MouseEvent): void {
_startY = container.y;
_startMouseY = mouseY;
stage.addEventListener(MouseEvent.MOUSE_MOVE, stage_mouseMoveHandler, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, stage_mouseUpHandler, false, 0, true);
}
function stage_mouseMoveHandler(event: MouseEvent): void {
var offsetY: Number = mouseY - _startMouseY;
container.y = Math.max(Math.min(maxY, _startY + offsetY), minY);
container1.y = Math.max(Math.min(maxY, _startY + offsetY), minY);
}
function stage_mouseUpHandler(event: MouseEvent): void {
stage.removeEventListener(MouseEvent.MOUSE_MOVE, stage_mouseMoveHandler);
stage.removeEventListener(MouseEvent.MOUSE_UP, stage_mouseUpHandler);
}
