# \_rotation Direction to L and R

**URL:** <https://forum.kirupa.com/t/-rotation-direction-to-l-and-r/28712>\
**Category:** Uncategorized\
**Created:** [August 17, 2003, 11:21am UTC](https://forum.kirupa.com/t/-rotation-direction-to-l-and-r/28712 "2003-08-17T11:21:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nasih](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@nasih](https://forum.kirupa.com/u/nasih)\
**Post date:** [August 17, 2003, 11:21am UTC](https://forum.kirupa.com/t/-rotation-direction-to-l-and-r/28712/1 "2003-08-17T11:21:58Z")

</div>

Hi  
thanks for your time.

problem :

There is one wheel that Rotating using script.

when mouse moving to left , the wheel have to rotate TO LEFTward and

when mouse moving to right , the wheel have to rotate TO RIGHTward .

Here i am attaching FLA , please have a look and Help!

Nasih

---

<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, 2003, 12:02pm UTC](https://forum.kirupa.com/t/-rotation-direction-to-l-and-r/28712/2 "2003-08-17T12:02:54Z")

</div>

Put this code within the onEnterFrame handler…  
[AS]var dir = (\_root.\_xmouse\>this.\_x)-(\_root.\_xmouse\<this.\_x);  
this.\_rotation += dir\*25;[/AS]  
… Like that? 😛

---

<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, 2003, 1:16pm UTC](https://forum.kirupa.com/t/-rotation-direction-to-l-and-r/28712/3 "2003-08-17T13:16:18Z")

</div>

Yeah…works fine Thanks Kax :thumb:  
-----------------------------------------------------------------------onClipEvent(load){  
stop();  
var Elastic = .03;

## this.onEnterFrame = function(){ var dir = (\_root.\_xmouse\>this.\_x)-(\_root.\_xmouse\<this.\_x); this.\_rotation += dir\*25; this.\_x += (\_root.\_xmouse-this.\_x)\*Elastic; } }

oh…when u posted … i fell asleep Sorry, if i am late.  
Nasih

---

<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, 2003, 1:20pm UTC](https://forum.kirupa.com/t/-rotation-direction-to-l-and-r/28712/4 "2003-08-17T13:20:43Z")

</div>

You’re welcome, Nasih. =)
