Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mouse efect 1

Status
Not open for further replies.
Something like this,alter the speed variable and lengths of the lines to suit your needs:

Code:
function followMouse() {
	x += (_xmouse-x)/speed;
	y += (_ymouse-y)/speed;
	this.clear();
	this.lineStyle(1, 0x000000);
	this.moveTo(x, 0);
	this.lineTo(x, 400);
	this.moveTo(0, y);
	this.lineTo(550, y);
	updateAfterEvent();
}
//
speed = 10;
x = y=0;
this.onEnterFrame = followMouse;code]
 
oops...

Code:
function followMouse() {
    x += (_xmouse-x)/speed;
    y += (_ymouse-y)/speed;
    this.clear();
    this.lineStyle(1, 0x000000);
    this.moveTo(x, 0);
    this.lineTo(x, 400);
    this.moveTo(0, y);
    this.lineTo(550, y);
    updateAfterEvent();
}
//
speed = 10;
x = y=0;
this.onEnterFrame = followMouse;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top