X-axis opposite scroll

Does anyone knows how to make or where can I get a tutorial on how to make something slide when I move my mouse in opposite way on x-axis of the mouse move direction, but it should move with equal speed as mouse movement and it should stop if mouse stoped moving.


var xCen = Stage.width/2;
myMovieClip.onMouseMove = function() {
	this._x = xCen*2-_root._xmouse;

:wink: =)

or maybe you wanted something like this… ? :slight_smile:

var xCen = Stage.width/2, ease = 10;
myMovieClip.onEnterFrame = function() {
	this._x += ((xCen*2-_root._xmouse)-this._x)/ease;

kax, you saved my day. Actionscript you provided works just great and this is just what I was looking for. I’m thanking you for helping me.

If you would, can you briefly explain few lines of the actionscript?

Again thank you very much for helping :slight_smile:

You can also check that. Not sure the explanations are better though:


It’s good too but not quite what I was looking for, ilyaslamasse. That tutorial shows mouse relative scroll and scrolling doesn’t stop when mouse stoped moving.

Kax hit right on target and gave the exact actionscript I’ve been looking for.


do you still need the explanation? because i really suck at that, you may get really confused… :stuck_out_tongue:

by the way, welcome to kirupa forum!! =)

No, don’t worry about it. I’ll figure out the code later with Actionscript dictionary.

Thanks again for the help.


no problem. =)