package { import flash.display.*; import flash.geom.*; import flash.events.*; import flash.text.*; [SWF(width="465", height="465", frameRate="60")] public class FlashTest extends Sprite { private var textfield:TextField = new TextField(); function FlashTest() { textfield.width = textfield.height = 465; addChild(textfield); stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove); } private function onMouseMove(e:MouseEvent):void { var matrix:Matrix; var x:int, y:int; var pos:Point; matrix = new Matrix(mouseX, mouseY); textfield.text = matrix + "\n"; matrix.rotate(Math.PI/2); x = Math.round(mouseX*Math.cos(Math.PI/2)+mouseY*Math.sin(Math.PI/2)); y = Math.round(mouseY*Math.cos(Math.PI/2)+mouseX*Math.sin(Math.PI/2)); matrix.a = Math.round(Math.abs(matrix.a)); matrix.b = Math.round(Math.abs(matrix.b)); textfield.text += matrix + "\n"; textfield.text += x + ", " + y + "\n\n"; matrix = new Matrix(); matrix.translate((-100+1)/2, (-200+1)/2); matrix.rotate(Math.PI/2); matrix.translate((200-1)/2, (100-1)/2); pos = matrix.transformPoint(new Point(mouseX, mouseY)); textfield.text += matrix + "\n"; textfield.text += pos + "\n"; textfield.text += Math.round(pos.x) + ", " + Math.round(pos.y) + "\n\n"; } } } flash on 2009-12-31