3 Replies Latest reply on Oct 14, 2007 6:03 AM by Starlover_jacob

    Rotating a circle using mouse coords.

    rossmurphy88
      I'm trying to rotate a circle. I want the circle to rotate in relation to the mouse movement across the y axis. Here is my code so far:

      onClipEvent (enterFrame) {

      _root.xVal = Math.round(_root._xmouse-this._x);
      _root.xMove = Math.round(_root.xVal/10);
      this._x += _root.xMove;

      _root.circle._rotation += _root.xMove*.4;
      }

      And here is the swf so far: HERE

      As you can see, this is the idea i am getting at. I would like the globe to rotate CW when the mouse is moved to the right of the globe and CCW when the mouse is moved to the left of the globe. I would also like the globe to slow as it comes closer to the mouse, but faster as the mouse is further away.. similar to the box that moves above the globe.

      When the mouse is put on the globe i woul like it to come to a stop slowly so that the user can select something. If anyone has any ideas please help.

      Much appreciated,

      Thanks.
        • 1. Re: Rotating a circle using mouse coords.
          Starlover_jacob Level 1
          hello,
          i have seen your swf and i think you want the blocks on your circle to be menubuttons if i'm right?

          I would use back and next buttons to turn the button circle.
          This because your mouse must be at your button.. and if you move your mouse to the right or left to see the next button you can never click the button thats on top at that time.

          what you CAN do is make a rotationbar like your block.. and if your mouse is on the rotationblock the circle rotates.(like you did now)
          if you get your mouse off the block the rotiation stops and the button you want to see is on top.
          so the only difference is that you need the mouse to be at a predeclared area for rotation.

          Greetz, jacob
          • 2. Re: Rotating a circle using mouse coords.
            rossmurphy88 Level 1
            thanks for that but i don't want to limit myself to buttons. The buttons on the globe aren't the point. I want the mouse direction to control the movement of the globe, just like the photo spinning wheels. Here is an example..

            HERE

            Trying to get this same movement effect but with a 2D circle.
            • 3. Re: Rotating a circle using mouse coords.
              Starlover_jacob Level 1
              ah i see...
              i think you need to set the center at the top mid of the circle and if your mouse is at the right of it set the rotation of the circle +=5 and if it gets to the left of the center you do -5..

              something they use a lot in thumbnailscrollers.
              http://www.gotoandlearn.com/
              movie scrolling thumbnail panel.

              I hope you get some new ideas by this and find your solution. It's a nice idea you are creating.