In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2010-5-16

I never realized that if you push the mouse button down
then you can get MOUSE_MOVE events even after the cursor
leaves the stage.
Get Adobe Flash player
by wh0 16 May 2010
    Embed
/**
 * Copyright wh0 ( http://wonderfl.net/user/wh0 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/g6QB
 */

// I never realized that if you push the mouse button down
// then you can get MOUSE_MOVE events even after the cursor
// leaves the stage.
package {
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.desktop.Clipboard;
	import flash.desktop.ClipboardFormats;
	import flash.utils.getTimer;
	public class FlashTest extends Sprite {
		
		private var t:TextField = new TextField();
		
		public function FlashTest() {
			t.selectable = false;
			addChild(t);
			stage.addEventListener(MouseEvent.MOUSE_MOVE, m);
			stage.addEventListener(MouseEvent.CLICK, c);
		}
		
		private function m(e:MouseEvent):void {
			t.text = e.stageX + ', ' + e.stageY;
		}
		
		private function c(e:MouseEvent):void {
			Clipboard.generalClipboard.setDataHandler(ClipboardFormats.TEXT_FORMAT, h);
			t.text = 'copied';
		}
		
		private function h():String {
			return t.text;
		}
		
	}
}