A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: slider keeps moving on mouse out

  1. #1
    Senior Member
    Join Date
    Apr 2003
    Location
    Seattle
    Posts
    177

    slider keeps moving on mouse out

    Hello,

    I built a slider that has two identical horizontal MC's nested end to end inside another MC so when you move the mouse left and right over the MC it slides right and left in an endless loop. My problem is that to stop the slider from moving, the mouse must be in the exact center of the MC and if a person moves off the slider somewhere to one side or the other, it keeps sliding. What I would like to do is set it up so that wherever the slider is when the mouse moves off of it, it simply stops moving. I was thinking maybe an _y parameter would do it (the MC is 18 px high) but I'm not sure how to code this.

    Here's what I'm working with:

    onClipEvent (enterFrame) {
    xcenter = 467.5;
    speed = 1/15;
    if (_root.mask.hitTest(_root._xmouse, _root._ymouse,false)) {
    var distance = _root._xmouse-xcenter;
    }
    _x -= (distance*speed);
    if (_x>0) {
    _x = -935;
    }
    if (_x<-935) {
    _x = 0;
    }
    }

    Any suggestions would be most helpful. (As a side note, the slider contains dates and if you click on anyone of them, the MC above the slider changes it's display accordingly.)

    Thanks in advance,
    -Llyfre

  2. #2
    Senior Member
    Join Date
    Apr 2003
    Location
    Seattle
    Posts
    177
    Here's the code formatted and I'm using AS2 with Flash CS4.....
    Actionscript Code:
    onClipEvent (enterFrame) {
    xcenter = 467.5;
    speed = 1/15;
    if (_root.mask.hitTest(_root._xmouse, _root._ymouse,false)) {
    var distance = _root._xmouse-xcenter;
    }
    _x -= (distance*speed);
    if (_x>0) {
    _x = -935;
    }
    if (_x<-935) {
    _x = 0;
    }
    }

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