package { import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageDisplayState; import flash.display.StageScaleMode; import flash.events.MouseEvent; import flash.text.TextField; import flash.ui.ContextMenu; import flash.ui.ContextMenuBuiltInItems; public class NewMouseFeatures extends Sprite { private var txt:TextField; public function NewMouseFeatures() { stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; stage.addEventListener(MouseEvent.CLICK, onClick); stage.addEventListener(MouseEvent.RIGHT_CLICK, onRightClickNow); stage.addEventListener(MouseEvent.MIDDLE_CLICK, onMiddleClick); stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove); stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel); stage.showDefaultContextMenu = false; stage.Enabled = true; stage.addEventListener(MouseEvent.DOUBLE_CLICK, ); txt = new TextField(); txt.width = 400; txt.height = 600; txt.selectable = false; txt.mouseEnabled = false; txt.text = "Double click for fullscreen to enable mouseLock. Try right click and middle click as well."; addChild(txt); } protected function onMouseWheel(event:MouseEvent):void { log("wheel: "+event.delta); } protected function log(str:String):void{ txt.text = str+"\n"+txt.text; } protected function onMouseMove(event:MouseEvent):void { if(stage.displayState == StageDisplayState.FULL_SCREEN){ log("movementX: "+event.movementX + " - movementY: " + event.movementY); } } protected function onClick(event:MouseEvent):void { log("left click"); } protected function onMiddleClick(event:MouseEvent):void { log("middle click"); } protected function (event:MouseEvent):void { log("double click"); if(stage.displayState == StageDisplayState.NORMAL){ stage.displayState = StageDisplayState.FULL_SCREEN; stage.mouseLock = true; }else{ stage.mouseLock = false; stage.displayState = StageDisplayState.NORMAL; } } protected function onRightClickNow(event:MouseEvent):void { log("right click"); } } }