PDA

View Full Version : boundaries for MC mousetrack


papapapapapa
02-01-2001, 10:52 PM
I have a MC that follows mouse with velocity drag. I want the MC to stop at the left and right edge of main movie.
this is my script so far:


onClipEvent (enterFrame) {
_root.vrule_mc._x = _root.vrule_mc._x+(_root._xmouse-_root.vrule_mc._x)/2;
}


//what now?

thanks to all. First time here!

Jesse
02-01-2001, 11:21 PM
Set a conditional cluase which prevents your set _x being equal to 0, (in this case I'm prventing it being equal to 0 + half the width of my clip, this causes the clip to stop when it's left or right side is exactly on the movie border):
onClipEvent (enterFrame) {
if (_root.vrule_mc._x+(_root._xmouse-_root.vrule_mc._x)/2 > (0+ _root.vrule_mc._width/2) && _root.vrule_mc._x+(_root._xmouse-_root.vrule_mc._x)/2 < (550 - _root.vrule_mc._width/2)) {
_root.vrule_mc._x = _root.vrule_mc._x+(_root._xmouse-_root.vrule_mc._x)/2;
}
}


Cheers

Jesse

papapapapapa
02-02-2001, 01:34 PM
Many thanks for the help! I'm new to AS and I want to tell you that after reading every book on the subject I could find, I'm grateful for your kind assistance, without which I'd be lost!

thanks again,

papapapapapa

Jesse
02-02-2001, 11:31 PM
Not a problem, that's what we're here for.

Cheers

Jesse