I’ve managed to figure out the action scripting for a mouse follow along a Y axis. I want to limit the follow to just a certain contained area on the page. What scripting would I use for that? Thanks
kristinu
I’ve managed to figure out the action scripting for a mouse follow along a Y axis. I want to limit the follow to just a certain contained area on the page. What scripting would I use for that? Thanks
kristinu
add an if statement to limit the area. post if you need more indepth answers.
yeah, i’m a little slow on the uptake…
I downloaded a certain mouse follow script from virtual fx:
virtual-fx.net/vfx/tutori…020109.php
…
The action scripting that goes along with it is:
thisY = getProperty("/drg1", _y);
spY = getProperty("/spin1", _y);
difY = thisY-spY;
yStp = difY/10;
setProperty("/spin1", _y, Number(spY)+Number(yStp));
…
Where in this party of fun would I place the if? Thanks for the quick reply
kristinu
Ok, well I’m about to throw a grenade into your party. That tutorial was made in Flash 4 and it used depreciated code (old code) I fixed the code so it is updated:
onClipEvent(load){
        friction = 8
}
onClipEvent(enterFrame){
        nXdiff = _root._xmouse - _x
        nYdiff = _root._ymouse - _y
        _x += nXdiff/friction
        _y += nYdiff/friction
}
this code would go right on the MovieClip. Now with the restriction it would look like:
onClipEvent (load) {
        friction = 8;
}
onClipEvent (enterFrame) {
        nXdiff = _root._xmouse - _x;
        nYdiff = _root._ymouse - _y;
        if (_root._xmouse >= 50 && _root._xmouse <= 300) {
                _x += nXdiff / friction;
        }
        if (_root._ymouse >= 50 && _root._ymouse <= 300) {
                _y += nYdiff / friction;
        }
}
if you have any specific questions, ask away…
Everything worked out well. Thanks for helping me out with that. I was pretty sure that the code I was using was older than sin. Thanks again
kristinu
no problem. post again if ya ever need anything.