I have a VBox containing a bunch of panels. I have implemented dragging and dropping but I need to be able to scroll automatically when the item is drug near the edge. I am having mixed results. I can get it to work, but not well. My example is below. It works if the user bounces their mouse around a little near the top or bottom edge, but I want it to work if they just hold the mouse there. Any suggestions?
On Mouse down (I'm doing several other things but this is one of them):
VBox(di.parent).addEventListener(MouseEvent.MOUSE_MOVE,autoScrollSection,true,500);
On dragDrop
VBox(evt.currentTarget.parent).removeEventListener(MouseEvent.MOUSE_MOVE, autoScrollSection,true);
Here is the autoScroll function:
private function autoScrollSection(evt:MouseEvent):void{
var tempVBox:VBox = VBox(evt.currentTarget);
if(tempVBox.mouseY<50){
tempVBox.verticalScrollPosition += -50;
}
if(tempVBox.mouseY> int(tempVBox.height-50)){
tempVBox.verticalScrollPosition += +50;
}
}
So if they are within 50px of an edge then it should scroll by 50px. I've exaggerated the numbers just to get an affect.