dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: reversing action script?!

  1. #1

    reversing action script?!

    i am using the following code to have images scroll across the screen in accordance to where the mouse moves i.e. if the mouse moves left the images move left.

    the code was from :

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

    and goes like this:

    onClipEvent (load) {
    xcenter = 275; 275 = 1/2 movie width
    speed = 1/10;
    }
    onClipEvent (enterFrame){
    var distance=_root._xmouse-xcenter;
    _x += (distance*speed);
    if (_x>0) _x=-550; 550 = width of movie
    if (_x<-550) _x=0;
    }

    i want to be able to reverse this code so when the mouse goes left the images go right and when the mouse goes right the images go left? any ideas?!

    sadie



    thanx for any help

  2. #2
    Senior Member
    Join Date
    Jan 2001
    Posts
    472
    I believe you just have to change this line:

    var distance = _root._xmouse - xcenter;

    to

    var distance = xcenter - _root._xmouse;

  3. #3

    perfect!

    thank you!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center