Inverted horizontal scrolling

Hey,

I’ve got some actionscript I’m working on. I’ve got it to a pretty good point, but I’m having trouble refining the movement.

Here is my code, nice and simple:


onClipEvent (enterFrame) {
    if(this._ymouse >= 60 || this._ymouse <= -60){
        
    }else{
        xPos = (_parent.thumbStage._xmouse);
        speed = xPos / 20;
        this._x = this._x + (speed - (speed * 2));
    }
}

Basically, if your mouse is on the right of the screen, the movieclip moves left and visa versa. It stops this from happening if you move your mouse too far away from it.

This all works, but there are a couple of problems.

Firstly, when the mouse moves more than 60 px away, it just stops. It’s not very elegant. Secondly, it never stops scrolling. There needs to be a limit. I did get that working too, but it just ends up vibrating when it gets to the end because I was simply shifting the movieclip back to a certain position where it was instantly sliding back over the limit and repeating the process.

I’ve tried adding some easing to it using a little bit of code from the easing on mouse click tutorial but it didn’t work.

Can anyone point me in the right direction?

I’ve uploaded the .fla if that helps. You can see I’ve grabbed some code for a fisheye style menu, but I plan on replacing that with my own code at some point as it doesn’t work exactly how I need.