3 Replies Latest reply on May 11, 2006 8:33 AM by Newsgroup_User

    drag along atan created angle

    Level 7
      Hi all,

      I want to be able to let the user drag a movieClip along an angle that is
      built with Math.atan

      This is the code I use to build the angle:

      angle = Math.atan((oppositeSide)/(adjacentSide))/(Math.PI/180);

      Because this angle can change depending on what the end user chooses for a
      ramp, I'm not sure how to set my movieClip so that as it is dragged, it is
      constrained to this angle.

      Thanks in advance for any help.


        • 1. drag along atan created angle
          Craig Grummitt Level 3
          the following code lets the user drag a movieclip along a static path but could equally be used for a dynamic path.
          Does this help or had you got this far already?

          • 2. Re: drag along atan created angle
            Level 7
            Hi Craig - thanks for answering. I'm still a bit confused though.

            The code you provided works for dragging vertically (i.e. along the y axis),
            but I'm not sure how to make it go along a diagonal. Where it says:

            //place your mc on your angle here.does that mean more than just a
            "this._rotation = myNewAngle" line? As it stands now, the movieClip on the
            stage is rotated correctly, but how do I make it draggable only along it's
            new rotation angle.

            Again, thanks for your help. I appreciate it.






            "Craig Grummitt" <webforumsuser@macromedia.com> wrote in message
            news:e3uigd$s7n$1@forums.macromedia.com...
            > the following code lets the user drag a movieclip along a static path but
            > could equally be used for a dynamic path.
            > Does this help or had you got this far already?
            >
            >


            • 3. Re: drag along atan created angle
              Level 7
              Figured it out - turned out to be a pretty simple fix (which is always nice)

              For anyone interested: I put the original mc inside another mc. All my
              dragging code refers to the child (original) mc. My rotation value refers
              to the parent (new) mc. Once the parent is rotated, the drag along the x
              axis of the child is now along the angle of the parent. Ta-da.

              Craig - thanks again for your help. It's appreciated.





              "Brock" <bramsay@inlets.net> wrote in message
              news:e3vint$97q$1@forums.macromedia.com...
              > Hi Craig - thanks for answering. I'm still a bit confused though.
              >
              > The code you provided works for dragging vertically (i.e. along the y
              > axis), but I'm not sure how to make it go along a diagonal. Where it
              > says:
              >
              > //place your mc on your angle here.does that mean more than just a
              > "this._rotation = myNewAngle" line? As it stands now, the movieClip on
              > the stage is rotated correctly, but how do I make it draggable only along
              > it's new rotation angle.
              >
              > Again, thanks for your help. I appreciate it.
              >
              >
              >
              >
              >
              >
              > "Craig Grummitt" <webforumsuser@macromedia.com> wrote in message
              > news:e3uigd$s7n$1@forums.macromedia.com...
              >> the following code lets the user drag a movieclip along a static path but
              >> could equally be used for a dynamic path.
              >> Does this help or had you got this far already?
              >>
              >>
              >
              >