ok… I have an MC with a small triangle that follows your mouse position only along the x axis. I dont want this to happen all over the entire stage rather only if your mouse is within a 40 pixel high band across the stage. If that band happend to be from
y=0 to y=40 I would write this code:
kinda… here is the swf I am working with… the triangle follows the mouse on the x axis anywhere you move… I only want it to do this while the cursor is in the blue area… then if you move out it would just freez even with where you left then move back to your cursor when you reenter.
this is the code I am using just to get the motion:
It’s normal that it’s not working. If you define an onEnterFrame handler, you have to reset it. Here, you’re saying: if I’m here on the screen, I want you to do that on every frame. But when you get out of that zone, the onEnterFrame is independent, it keeps going and going.
Not sure if I follow. Try the second fla that I posted. It looks to me like it works the way he wanted… unless I got the wrong idea - check it out and let me know
ok one more question… I’d like to add something to this existing code:
var speed = 8;
triangle.onEnterFrame = function() {
if (_ymouse > 0 && _ymouse < 40) {
this._x += (this._parent._xmouse-this._x)/speed;
}
};
I’d like to stop when you leave the area between 0y and 40y, but before it stops I’d like it to continue to your last x_position (that was withing the y range obviously).
I am thinking that I’ll need to define a target x_position on leaving the area, but I am unsure of the best way to go about this. Some help/direction would be great.
The code you posted returns the triangle I am using to a specific position no matter at what x value the mouse leaves the area at. I want it to return to the mouses last x position. I am working on… I’ll get it eventually, but if you have more ideas I’d appreciate it.