3 Replies Latest reply on Nov 7, 2008 10:44 AM by kglad

    Dragging while Scrolling Issue

      How can I effectivly drag an object and scroll the movieclip its in at the same time?

      Basically I have these boxes that I can drag that are contained with in another movieclip. This other movieclip is one that contains all my content and I have coded so that I can scroll through via mouse wheel.

      Now when i start dragging one of the boxes and then proceed to scroll with the mousewheel, it doesn't update the y position. I tried adding another listener for the mousewheel, one that would detect it and then realign the position of the box to the mouse pointer. Although this worked, it is quite jumpy and breaks when I scroll fast. By break I mean that it will not be in the position of underneath the mouse cursor but instead somewhere else.

      Here is the code I am using.

      var mouseListener2:Object = new Object(this);
      mouseListener2.onMouseWheel = function(wheelNum2:Number){
      this._y = _parent._ymouse;
        • 1. Re: Dragging while Scrolling Issue
          kglad Adobe Community Professional & MVP
          "this" in your listener is going to refer to your listener and Object is a constuctor that doesn't take a parameter.

          use the instance name of whatever you want to respond to the mousewheel instead of "this" in that listener.
          • 2. Re: Dragging while Scrolling Issue
            paulmatos Level 1
            i do not believe that is the issue. part of my code that i didnt include is that this is contained with in the onPress function for the button, even tracing "this" reveals that it is correctly getting the item. The problem I am having is related to how it is moving.

            The object moves fine when i scrub my mouse wheel slowly, although it does it somewhat in a jerky motion. But when I scrub my mouse wheel fast or in one big motion, it will break the position. and the object will no longer be under the mouse pointer.

            • 3. Re: Dragging while Scrolling Issue
              kglad Adobe Community Professional & MVP
              then don't use a mouse listener. use a loop that updates more frequently like an enterframe or setInterval loop.