5 Replies Latest reply on Dec 20, 2006 6:19 PM by Newsgroup_User

    Custom cursor

    jgn2006
      I thought this was simple. I need some custom cursors. Created the cursor as a movieclip object on a new layer's first frame and on its actions I have

      onCLipEvent(load) {
      this.startDrag();
      }

      when the movie loads, the custom cursor moves alright except its some distance from the standard cursor so its of course not working as expected and if I hide the cursor it will be unusable. Tried setting the movieclips _x to mouse x and that did not help either. What amd I missing?

        • 1. Re: Custom cursor
          Level 7
          You need to align the movieclip to the mouse.

          onClipEvent(load){
          this._x = _parent._xmouse;
          this._y = _parent._ymouse;
          this.startDrag();
          }

          However, this way you are dragging the movieclip and not to follow the
          cursor, if you need to drag an object there will be problems, because
          just an object can be being dragged.


          I recommend the following solution:

          //Mouse.hide();
          mcCursor.onMouseMove = function():Void{
          this._x = _xmouse;
          this._y = _ymouse;
          };


          --
          Regards,
          Erick Souza
          www.ericksouza.com
          • 2. Re: Custom cursor
            kglad Adobe Community Professional & MVP
            use an onEnterFrame method to assign your cursor's _x and _y properties to be the same as _root._xmouse and _root._ymouse.
            • 3. Re: Custom cursor
              jgn2006 Level 1
              Thanks Erick and kglad for your quick responses. Erick your suggestion seems to work very well. Better than using a mouse listener. I had tried adding that to a mouse listener and there seems to be a split second of delay between mouse movement and my custom cursor.
              • 4. Re: Custom cursor
                Level 7
                > seems to be a split second of delay between
                > mouse movement and my custom cursor.

                You might want to have a look at updateAfterEvent(); in the AS dictionary.

                --
                -------------------------------
                Remove '_spamkiller_' to mail
                -------------------------------


                • 5. Re: Custom cursor
                  Level 7
                  jgn2006 wrote:
                  > Thanks Erick and kglad for your quick responses. Erick your suggestion seems
                  > to work very well. Better than using a mouse listener. I had tried adding
                  > that to a mouse listener and there seems to be a split second of delay between
                  > mouse movement and my custom cursor.


                  Peter already said.. using the global function updateAfterEvent he will
                  work like you wants. The problem is caused by FPS, the updateAfterEvent
                  function updates the coordinates of the mc independently of FPS.


                  //Mouse.hide();
                  mcCursor.onMouseMove = function():Void{
                  this._x = _xmouse;
                  this._y = _ymouse;

                  updateAfterEvent();
                  };


                  --
                  Regards,
                  Erick Souza
                  www.ericksouza.com