Question : Mouse wheel action on scroller

Greetings,
I have a MovieClip that scrolls with created dragger and buttons and would like to get the MovieClip to also scroll with the mouse wheel in Actionscript 2.
My script follows:

scrolling = function () {
      var scrollHeight:Number = scrollbg._height;
      var contentHeight:Number = contentMain._height;
      var draggerHeight:Number = dragger._height;
      var maskHeight:Number = maskedView._height;
      var initPosition:Number = dragger._y=scrollbg._y;
      var initContentPos:Number = contentMain._y;
      var finalContentPos:Number = maskHeight-contentHeight+initContentPos;
      var left:Number = scrollbg._x;
      var top:Number = scrollbg._y;
      var right:Number = scrollbg._x;
      var bottom:Number = scrollbg._height-draggerHeight+scrollbg._y;
      var dy:Number = 0;
      var speed:Number = 10;
      var moveVal:Number = (contentHeight-maskHeight)/(scrollHeight-draggerHeight);
      
dragger.onPress = function() {
            dragger.draggerover._alpha = 100;
            var currPos:Number = this._y;
            startDrag(this, false, left, top, right, bottom);
            this.onMouseMove = function() {
                  dragger.draggerover._alpha = 100;
                  dy = Math.abs(initPosition-this._y);
                  contentMain._y = Math.round(dy*-1*moveVal+initContentPos);
            };
      };
      
dragger.onMouseUp = function() {
            dragger.draggerover._alpha = 0;
            stopDrag();
            delete this.onMouseMove;
      };
      
      btnUp.onPress = function() {
            this.onEnterFrame = function() {
                  if (contentMain._y+speed<maskedView._y) {
                        if (dragger._y<=top) {
                              dragger._y = top;
                        } else {
                              dragger._y -= speed/moveVal;
                        }
                        contentMain._y += speed;
                  } else {
                        dragger._y = top;
                        contentMain._y = maskedView._y;
                        delete this.onEnterFrame;
                  }
            };
      };
      btnUp.onDragOut = function() {
            delete this.onEnterFrame;
            btnUp.upover._alpha = 0;
      };
      btnUp.onRollOut = function() {
            delete this.onEnterFrame;
            btnUp.upover._alpha = 0;
      };
      btnDown.onPress = function() {
            this.onEnterFrame = function() {
                  if (contentMain._y-speed>finalContentPos) {
                        if (dragger._y>=bottom) {
                              dragger._y = bottom;
                        } else {
                              dragger._y += speed/moveVal;
                        }
                        contentMain._y -= speed;
                  } else {
                        dragger._y = bottom;
                        contentMain._y = finalContentPos;
                        delete this.onEnterFrame;
                  }
            };
      };
      btnDown.onRelease = function() {
            delete this.onEnterFrame;
      };
      btnDown.onDragOut = function() {
            delete this.onEnterFrame;
            btnDown.downover._alpha = 0;
      };
      if (contentHeight<maskHeight) {
            dragger._visible = false;
            btnUp.enabled = false;
            btnDown.enabled = false;
      } else {
            dragger._visible = true;
            btnUp.enabled = true;
            btnDown.enabled = true;
      }
};
scrolling();

Any help with this would be greatly appreciated.
Thanks
Mark

Answer : Mouse wheel action on scroller

best option it to just roll out the new RDB ... it's much safer.

If the remote user has data changes they want to keep, then you'll need to import the old remote into the new one before deleting it
Random Solutions  
 
programming4us programming4us