Mouse rotation

Code Actionscript 2.0

Instance action

onClipEvent (enterFrame) {
distance = _root._xmouse - this._x;
_rotation = _rotation + distance / 10;
}

Code Actionscript 3.0

addEventListener(Event.ENTER_FRAME, enterFrame); function enterFrame(event:Event) { var distance = mouseX - square.x; square.rotation = square.rotation +distance/10; }

Description

The square rotates with a speed that depends on the distance to the mouse.

related to: Knob

Download

Right click: Flashfile AS 2.0 | Flashfile AS 3.0 | SWF-File


Share