Follower?

Im attempting to create a mouse “follower” that follows my mouse across an x axis at the top of my flash document.

I have no idea where to start. Any suggestions?

Thanks :slight_smile:

hey how would i do this if i wanted it to follow both x and y? like following your mouse. I tried the following:

[AS]onClipEvent (enterFrame) {
speed += (this._parent._xmouse-this._x)*acceleration;
speed *= friction;
this._x += speed;
speed += (this._parent._ymouse-this._y)*acceleration;
speed *= friction;
this._y += speed;
}[/AS]

it kind of seems weird but on the right track.

any suggestions?

Define a variable for each axis! :wink:

onClipEvent (load) {
var acceleration = .4;
var friction = .6;
var xspeed = 0;
var yspeed = 0;
}
onClipEvent (enterFrame) {
xspeed += (this._parent._xmouse-this._x)*acceleration;
xspeed *= friction;
this._x += xspeed;
yspeed += (this._parent._ymouse-this._y)*acceleration;
yspeed *= friction;
this._y += yspeed;
}

thanks hehe :slight_smile:

You’re welcome. :beam: