
Код AS3:
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
public class DeltaRotation extends Sprite {
private var rotatingSprite:Sprite;
public function DeltaRotation() {
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(event:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
rotatingSprite = new Sprite();
rotatingSprite.graphics.lineStyle(1, 0x0000FF, 1, true);
rotatingSprite.graphics.beginFill(0x889988);
rotatingSprite.graphics.drawRoundRect(0, 0, 200, 45, 10, 10);
rotatingSprite.graphics.endFill();
stage.addChild(rotatingSprite);
rotatingSprite.x = rotatingSprite.y = 250;
stage.addEventListener(MouseEvent.MOUSE_WHEEL, rotateOnWheel);
}
private function rotateOnWheel(event:MouseEvent):void {
rotatingSprite.rotation += event.delta; //вращение скролом тут
}
}
}