You need to compare the previous mouse position to the current position everytime the mouse moves. The previous position would be the current position after each adjustment. In the examples you pointed to, when you press down (onMouseDown) with the mouse you would set the previous position and current position as the same value. Then, when you move the mouse (onMouseMove), the difference of the previous minus current will tell you the direction the mouse moved (positive is right, negative is left). Just after determining that you assign the previous value the current value.
Hi friend. Thank you very much. I could implement it. But another problem is that i want to detect when the mouse is not moving in onMouseMove event. Is there any tricks for it?
There is no way to detect if the mouse is NOT moving using the onMouseMove event. By definition onMouseMove only happens when the mouse is moving! There is no trick for that.
Generally if you need to deal with that type of thing you should use an onEnterFrame or setInterval.
Ok freind I did it.Thank you.