/**
* 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;
}
}
}