I really don’t know why this is happening.
I have a menu on the side of the screen (“sidePanel_mc”) that should scroll inversely when the cursor is placed over it (meaning that when the cursor moves down, the menu goes up and vice versa).
The inexplicable occurrence is this: the pace at which the side menu moves is progressively accelerating, even though I have it fixed at “1”. So each time you move the mouse, let’s say, a centimeter, the menu will shift progressively more pixels until it covers its entire allowed movement.
I don’t know what I’m missing, although I fear it is something obvious. Any help would be appreciated.
Here’s the code:
[SIZE=“2”]
var startY:Number = new Number;
var mouseStartY:Number = new Number;
var difference:Number = new Number;
sidePanel_mc.addEventListener(MouseEvent.MOUSE_OVER, startScroll);
function startScroll(e:MouseEvent)
{
mouseStartY = mouseY;
startY = sidePanel_mc.y;
sidePanel_mc.addEventListener(MouseEvent.MOUSE_MOVE, scrollY);
function scrollY(e:Event)
{
difference = mouseY-mouseStartY;
if(difference < 0)
{
if(sidePanel_mc.y <66){sidePanel_mc.y += 1;};
};
if(difference > 0)
{
if(sidePanel_mc.y >-378){sidePanel_mc.y -= 1;};
};
}
};
[/SIZE]