I have this example of hw to make a movie clip follow the mouse by using the
current position of the mouse (_Mousex and _mousey)...but now i wnt the movie clip to
go the opposite direction of the mouse..4 e.g if the mouse is @ Y=5 and X=2 then the movie clip 2
b @ Y=-5 and X=-2...is there a way of doing this,thanx

I'm not sure I got your question, but I guess it's simple...
0 - mouseX
0 - mouseY
By the way, you are using an old version of AS

Thanx bt i hv tried it n it dsnt work...pls try it n c if it works coz i might b making a small mistake.

Show me the code...

i have this code

onClipEvent (load)
{
//current position of the movie clip
this._x = 0;
this._y = 0;
//speed
var speed = 20;
}
onClipEvent (enterFrame)
{
//position of the movie clip =position of the mouse -prev position of the movie clip at that speed
_x =- (_xmouse - _x)/speed;
_y =- (_ymouse - _y)/speed;
}

it seems to work but the movie clip goes 2 the top left corner n stucks there,i want it 2 b in the middle..pls help ,thanx 4 replying

Member Avatar for rajarajan2017

The below code will work

onClipEvent (load)
{
	var speed = 10;
} 

onClipEvent (enterFrame)
{
//position of the movie clip =position of the mouse -prev position of the movie clip at that speed
_x = -(_xmouse - this._x)/speed;
_y = -(_ymouse - this._y)/speed;
_x+=200;
_y+=100;
}
Member Avatar for rajarajan2017

The below code will work

onClipEvent (load)
{
	var speed = 10;
} 

onClipEvent (enterFrame)
{
//position of the movie clip =position of the mouse -prev position of the movie clip at that speed
_x = -(_xmouse - this._x)/speed;
_y = -(_ymouse - this._y)/speed;
_x+=200;
_y+=100;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.