# Freely Rotate Objects

**URL:** <https://forum.kirupa.com/t/freely-rotate-objects/10400>\
**Category:** flash\
**Created:** [December 31, 2002, 7:57am UTC](https://forum.kirupa.com/t/freely-rotate-objects/10400 "2002-12-31T07:57:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlashingLady](https://avatars.discourse-cdn.com/v4/letter/f/a183cd/32.png) [@FlashingLady](https://forum.kirupa.com/u/FlashingLady)\
**Post date:** [December 31, 2002, 7:57am UTC](https://forum.kirupa.com/t/freely-rotate-objects/10400/1 "2002-12-31T07:57:26Z")

</div>

Hello Everyone :beam:

I’ve been working on a flash animation and have become stuck. :\*(

I have objects that are draggable, but I would like to put in a control to freely rotate the object. I had assigned individual buttons to each object so that when they are pressed, the object will face in that direction, although I would like to add a key on the object that can be used to rotate it around its center.

Does anybody know a way to accomplish this? Your help would be greatly appreciated.

-Ashley

---

<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:** [December 31, 2002, 8:13am UTC](https://forum.kirupa.com/t/freely-rotate-objects/10400/2 "2002-12-31T08:13:48Z")

</div>

Well if you don’t mind using components to do it you can find a couple that do exactly that at [http://www.flashcomponents.net/](http://www.flashcomponents.net/)

---

<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:** [December 31, 2002, 11:28am UTC](https://forum.kirupa.com/t/freely-rotate-objects/10400/3 "2002-12-31T11:28:36Z")

</div>

if I get you right… use

```auto

// for on the movieclip
on(press){
	dragging = true;
	orig_mouse_angle = Math.atan2(_parent._ymouse-_y, _parent._xmouse-_x) * 180/Math.PI;
	orig_rotation = _rotation;
}
on(release,releaseOutside){
	dragging = false;
}
onClipEvent(mouseMove){
	if(dragging){
		curr_mouse_angle = (Math.atan2(_parent._ymouse-_y, _parent._xmouse-_x) * 180/Math.PI)
		_rotation = orig_rotation + curr_mouse_angle - orig_mouse_angle;
		updateAfterEvent()
	}
}

```

or

```auto

// from the timeline
clip.onPress = function(){
	this.dragging = true;
	this.orig_mouse_angle = Math.atan2(this._parent._ymouse-this._y, this._parent._xmouse-this._x) * 180/Math.PI;
	this.orig_rotation = this._rotation;
}
clip.onRelease = clip.onReleaseOutside = function(){
	this.dragging = false;
}
clip.onMouseMove = function(){
	if(this.dragging){
		var curr_mouse_angle = (Math.atan2(this._parent._ymouse-this._y, this._parent._xmouse-this._x) * 180/Math.PI)
		this._rotation = this.orig_rotation + curr_mouse_angle - this.orig_mouse_angle;
		updateAfterEvent();
	}
}

```
