Rollover2
Code Actionscript 2.0
Instance action
onClipEvent (load) {
speed = 0;
}
onClipEvent (enterFrame) {
_rotation = _rotation + speed;
}
on (rollOver) {
speed = 3;
}
on (rollOut) {
speed = 0;
_rotation = 0;
}
Code Actionscript 3.0
addEventListener(Event.ENTER_FRAME, enterFrame); square.addEventListener(MouseEvent.ROLL_OVER, rollOver); square.addEventListener(MouseEvent.ROLL_OUT, rollOut); var speed= 0; function enterFrame(event:Event) { square.rotation = square.rotation + speed; } function rollOver(e:MouseEvent) { speed= 3; } function rollOut(e:MouseEvent) { speed= 0; square.rotation = 0; }
Description
When the mouse rolls over the square, the square begins to rotate. When the mouse rolls out, both the speed and angle of rotation are reset to their initial value of 0, causing the squares movement to stop.
related to: Rotate
Download
Right click: Flashfile AS 2.0 | Flashfile AS 3.0 | SWF-File