Hi all. Trying to recode a scrolling thumbnail panel I found as an example of the web into AS3 mostly for educational purposes (to the person who created the example, thanks, forgot where I found it) but getting stuck in a couple of places. The panel works but my problems are:
-
lower boundary doesn’t work, panel continues to scroll into infinity.
-
as it is written, the mouse event that activates the scrolling is MOUSE_MOVE, which is kind of a pain as the scrolling is kind of “jerky”, I have tried to make it an MOUSE_OVER event, but I think it may be conflicting with the prior MOUSE_OVER event. Not sure.
Code is below, it’s not very clean, I’m kind of a hack and rusty on top of that. Thanks in advance for any help.
panel.addEventListener(MouseEvent.ROLL_OVER, panelOver);
var vert:Number = stroke.height;
var horiz:Number = stroke.width;
var vertpos:Number = stroke.y;
var horizpos:Number = stroke.x;
//trace(panel.y);
function panelOver(event:MouseEvent):void
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, panelMover);
function panelMover(event:MouseEvent):void
{
if(event.stageY > vertpos && event.stageY < vert && event.stageX > horizpos && event.stageX < horiz){
panel.y -= Math.round((event.stageY-(vert/2))/40);
}
if(panel.y >= 45) {
panel.y = 45}
}
if(panel.y <= -1344) {
panel.y = -1344}
{
}
}