<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="0xffffff" applicationComplete="init()" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ private function init() : void { this.addEventListener(Event.ENTER_FRAME, onEnterFrame); stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageMouseDown); stage.addEventListener(MouseEvent.MOUSE_UP, onStageMouseUp); stage.addEventListener(Event.MOUSE_LEAVE, onStageMouseLeave); } private function onEnterFrame(event : Event) : void { textField.text = 'stageWidth: ' + stage.stageWidth; textField2.text = 'stageHeight: ' + stage.stageHeight; textField3.text = 'mouseX: ' + this.mouseX; if (this.mouseX > stage.stageWidth) textField3.text += ' (outside stage)'; textField4.text = 'mouseY: ' + this.mouseY; if (this.mouseY > stage.stageHeight) textField4.text += ' (outside stage)'; } private function onStageMouseDown(event : MouseEvent) : void { textArea.text += '\nmouseDown'; } private function onStageMouseUp(event : MouseEvent) : void { textArea.text += '\nmouseUp'; } private function onStageMouseLeave(event : Event) : void { if (this.mouseX > stage.stageWidth || this.mouseY > stage.stageHeight) textArea.text += '\nmouseLeave (outside stage) == mouseUp'; else textArea.text += '\nmouseLeave'; } ]]> </mx:Script> <mx:VBox width="400" height="400" horizontalCenter="0" verticalCenter="0" verticalGap="0"> <mx:Text width="100%" fontSize="10" color="0x000" text="Press the mouse button down within the stage and move mouse outside the browser window to keep track of cursor position" /> <mx:Spacer height="5" /> <mx:Text id="textField" width="100%" height="20" fontSize="10" color="0x000" selectable="false" /> <mx:Text id="textField2" width="100%" height="20" fontSize="10" color="0x000" selectable="false" /> <mx:Spacer height="5" /> <mx:Text id="textField3" width="100%" height="20" fontSize="10" color="0x000" selectable="false" /> <mx:Text id="textField4" width="100%" height="20" fontSize="10" color="0x000" selectable="false" /> <mx:Spacer height="5" /> <mx:TextArea id="textArea" width="100%" height="100%" color="0x000" selectable="false" editable="false" /> <mx:Button label="Clear" width="100%" cornerRadius="0" click="textArea.text = ''" /> </mx:VBox> </mx:Application>