1 Reply Latest reply on Mar 17, 2007 7:45 AM by kglad

    Action Script Help

    routhu
      Hi to all,

      This is vertical xml gallery code, where the mouse will move up, then the scoller will move up and vice versa. now i want the reverse . if it move up , then the scoller come down and if it move down , then the scoller move up.

      Can anyone please help me.

      Thanks
      Krishna

      quote:

      this.onEnterFrame = function()
      {
      mask_y = _root.main.verti.mask._y;
      mask_h = _root.main.verti.mask._height;
      mask_middle = (mask_y + mask_h) / 2; // take middle of mask as reference

      roller_y = _root.main.verti.roller._y;
      roller_h = _root.main.verti.roller._height;
      ymouse = _root.main.verti.mask._ymouse;

      // if mous out of range
      if (ymouse < mask_y || ymouse> mask_y + mask_h)
      speed = 0;
      else
      speed = (ymouse - mask_middle)/ 10;
      // calculate speed -> the closer to middle-> slower, closer to edges-> faster


      // if roller bottom reaches mask bottom and scroll up, stop
      if ((roller_y+roller_h)<(mask_y+mask_h) && speed < 0)
      speed = 0;
      // if roller top reaches mask top and scroll down, stop
      if (roller_y > mask_y && speed > 0)
      speed = 0;
      _root.main.verti.roller._y += speed;
      }
      stop();