-
Help with Mouse tracking with inertia. Need to stop and start on mouse over Y cord
What I want to do is have the mouse tracking acending on the Y stop at a certain point on the stage while the mouse keeps going(for example: if you are mousing up and the scroller is following the mouse, when you get to a certain point, say 200 on the Y, then the mouse tracking would stop at 200) Then when the mouse goes below 200 the mouse tracking would start to follow again.
Can anyone help?
here is my code so far:
onClipEvent (enterFrame) {
myRadians = Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x);
myDegrees = Math.round((myRadians*180/Math.PI));
_root.yChange = Math.round(_root._ymouse-this._y);
_root.xChange = Math.round(_root._xmouse-this._x);
_root.yMove = Math.round(_root.yChange/5);
this._y += _root.yMove;
this._x += _root.xMove;
}
Last edited by sonicorange; 07-27-2005 at 05:38 PM.
-
Registered User
hi,
If I understand your question, this may be what you want:
code:
onClipEvent (enterFrame) {
if (_root._ymouse <= 200 && _root._ymouse >= 0) {
_root.yChange = Math.round(_root._ymouse - this._y);
} else if (_root._ymouse < 0) {
_root.yChange = Math.round(0 - this._y);
} else if (_root._ymouse > 200) {
_root.yChange = Math.round(200 - this._y);
}
_root.yMove = Math.round(_root.yChange / 5);
this._y += _root.yMove;
}
For the code you provided, there is some extra code you don't need, All that's needed is:
code:
onClipEvent (enterFrame) {
_root.yChange = Math.round(_root._ymouse - this._y);
_root.yMove = Math.round(_root.yChange / 5);
this._y += _root.yMove;
}
-
Thanks for the help! It works, except i need it to go below 200 and not above.
-
got it! the final code is:
onClipEvent (enterFrame) {
if (_root._ymouse >= 200 && _root._ymouse <= 800) {
_root.yChange = Math.round(_root._ymouse - this._y);
} else if (_root._ymouse < 200) {
_root.yChange = Math.round(200 - this._y);
}
_root.yMove = Math.round(_root.yChange / 5);
this._y += _root.yMove;
}
Thanks for your help.!!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|