Mouse X Y position help please

Ok I have been randomly entering numbers so that when you move the mouse left the images move right and so on…

This is the code I’m using [I think I got it from FK originally a while back??].


onClipEvent (mouseMove) {
    xmousepos1 = _xmouse;
    ymousepos1 = _ymouse;
    if (xmousepos1>xmousepos2 && ymousepos1>-98 && ymousepos1<-33) {
        _root.scrollclip.nextFrame();
    }
    if (xmousepos1-98 && ymousepos1<-33) {
        _root.scrollclip.prevFrame();
    }
    if (ymousepos1<-98 || ymousepos1>-33) {
        play ();
    }
    xmousepos2 = _xmouse;
    ymousepos2 = _ymouse;
}



As you can see from my FLA it’s not quite working the way it should. Is there a cleaner way of doing this?
If so could someone kindly point me in the right direction before I beat myself to death with my mouse. :frowning:

FLA Download

Thanx in advance.

try something like this instead. It will end up working better than what you are doing now…

edit++++

forgot the link:

http://www.kirupa.com/developer/mx/infinite.htm

Thanx for that.

I did do a search but didn’t come across that tut.

Thanx again bro :smiley:

no problem. Hope you get it sorted out. If you need anything else just post. :slight_smile:

Will do man :slight_smile: Cheers

Hey, just another quick question. :slight_smile:

Using the code from this tut how would I make the scroller move in the opposite direction to the mouse?

onClipEvent (load)
{
   xcenter=285;
   speed=1/20;
}
onClipEvent (enterFrame)
{
   var distance=_root._xmouse-xcenter;
   _x+=(distance*speed);
   if (_x > 0) _x=-540;
   if (_x < -550) _x=0;
}

Again, thanx in advance

i havent read the tutorial, but try

_x -= (distance*speed);

instead of

_x+=(distance*speed);

I can’t believe I missed that lol.
Thanx man that did the job!!
Nice 1