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

# drag along atan created angle

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:

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
the following code lets the user drag a movieclip along a static path but could equally be used for a dynamic path.

• ###### 2. Re: drag along atan created angle
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.
>
>

• ###### 3. Re: drag along atan created angle
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.