PDA

View Full Version : MOVE IN OPPOSITE DIRECTION OF MOUSE



ryu_ninjato
October 21st, 2004, 03:52 AM
HEY, I'M NEW TO FLASH KIT!!!!
Unfortunately I need some help URGENTLY!!!!

I want to make a movieclip MOVE IN THE OPPOSITE DIRECTION OF THE MOUSE according to the parameters of a smaller version of the same movieclip.

So, I want it so that if the mouse is at the egde of the small movieclip then that area of the larger clip can be seen through a a scripted mask that follows the mouse

I Already Scripted the Mask- Don't worry

I want it to look kinda like the attached file but I want the lrg clip to stop once you get to the egdes of the small clip.

This would help alot.

I kinda have a deadline

Thanks!!!

icio
October 21st, 2004, 04:57 PM
hm... i wonder if nobody has replied because this is not flash kit?

anyway, if you're doing this in mx, put this code onto the movieclip that you want to move:

onClipEvent (load) {
this._y = _root._ymouse;
this._x = _root._xmouse;
}
onClipEvent (mouseMove) {
if (!prevX || !prevY) {
prevX = _root._xmouse;
prevY = _root._ymouse;
}
//
this._x += prevX-_root._xmouse;
this._y += prevY-_root._ymouse;
//
prevX = _root._xmouse;
prevY = _root._ymouse;
updateAfterEvent();
}

hope this helps :P

ryu_ninjato
October 22nd, 2004, 01:08 AM
Thanks alot!
But just a few seconds ago I figured it out.
Again thanks alot for the advice. i might have somemore questions later.
:hugegrin:



hm... i wonder if nobody has replied because this is not flash kit?

anyway, if you're doing this in mx, put this code onto the movieclip that you want to move:

onClipEvent (load) {
this._y = _root._ymouse;
this._x = _root._xmouse;
}
onClipEvent (mouseMove) {
if (!prevX || !prevY) {
prevX = _root._xmouse;
prevY = _root._ymouse;
}
//
this._x += prevX-_root._xmouse;
this._y += prevY-_root._ymouse;
//
prevX = _root._xmouse;
prevY = _root._ymouse;
updateAfterEvent();
}

hope this helps :P
:hugegrin:

Gupps
October 22nd, 2004, 01:52 PM
what did you actually change to make it work ryu_ninjato. change the speed to a minus number?