# Rotating the mc

**URL:** <https://forum.kirupa.com/t/rotating-the-mc/4670>\
**Category:** Uncategorized\
**Created:** [August 15, 2002, 9:06pm UTC](https://forum.kirupa.com/t/rotating-the-mc/4670 "2002-08-15T21:06:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![luksy](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@luksy](https://forum.kirupa.com/u/luksy)\
**Post date:** [August 15, 2002, 9:06pm UTC](https://forum.kirupa.com/t/rotating-the-mc/4670/1 "2002-08-15T21:06:59Z")

</div>

I asked this before but I was unable to view the answer because I had problems with a modem. So here’s the question.

When you drag a mc it rotates. And when you release drag, it stops rotating and it stays at that point.

Thank you and also I am sorry.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2002, 5:58am UTC](https://forum.kirupa.com/t/rotating-the-mc/4670/2 "2002-08-16T05:58:20Z")

</div>

this might work.

place a button inside the movie clip in question… on it’s timeline.

attach to the outside of the movie clip that contains the button, this code

onClipEvent(enterFrame){  
if(flag){  
this.\_rotation++;  
}  
}

attach to the button this script.

on(press){  
\_parent.startDrag();  
\_parent.flag=true;  
}  
on(release){  
\_parent.stopDrag();  
\_parent.flag=false;  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 16, 2002, 2:19pm UTC](https://forum.kirupa.com/t/rotating-the-mc/4670/3 "2002-08-16T14:19:30Z")

</div>

Sorry, Dave… I don’t know if that would work. I’ll give it a shot, though.

My first thought was to make a simple tween that rotate the object

on the movie clip, this code.

```auto

onClipEvent(load){
	gotoandstop(1);
}

on(press){
	_root._xmouse=this._x;
	gotoandplay(1);
	this.startdrag();
}
on(release){
	gotoandstop(this._currentframe);
	this.stopdrag();
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 17, 2002, 3:47pm UTC](https://forum.kirupa.com/t/rotating-the-mc/4670/4 "2002-08-17T15:47:25Z")

</div>

David’s code didn’t seem to work but when you change one line it works perfectly.

onClipEvent(enterFrame){  
if(\_root.flag){  
this.\_rotation++  
}  
}  
on(press){  
this.startDrag();  
\_root.flag=true;  
}  
on(release){  
this.stopDrag();  
\_root.flag=false;  
}

if you just change the code from \_parent to \_root it seems to work perfectly.

Hope this helps

Kyle

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 17, 2002, 4:06pm UTC](https://forum.kirupa.com/t/rotating-the-mc/4670/5 "2002-08-17T16:06:34Z")

</div>

oh yeah… I forgot to direct that correctly. If it works that way it should also work like this

onClipEvent(enterFrame){  
if(flag){  
this.\_rotation++  
}  
}

* * *

on(press){  
this.startDrag();  
flag=true;  
}  
on(release){  
this.stopDrag();  
flag=false;  
}

I forgot that a button on the timeline would make a variable on that timeline, which in turn would be readable localy by the movieclip onClipEvent(){} method.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 17, 2002, 4:16pm UTC](https://forum.kirupa.com/t/rotating-the-mc/4670/6 "2002-08-17T16:16:58Z")

</div>

and if you want to make it go faster change this.\_rotation++ to this.\_rotation += 5. You change the number 5 to any number you want, the highter the number the faster the rotation.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 19, 2002, 3:56pm UTC](https://forum.kirupa.com/t/rotating-the-mc/4670/7 "2002-08-19T15:56:27Z")

</div>

THank you! Thank you! That’s ok. The first post already helped me! :))  
OK. Over.
