forked from mojombo/clippy
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclippy.hx
More file actions
30 lines (23 loc) · 938 Bytes
/
clippy.hx
File metadata and controls
30 lines (23 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.SimpleButton;
class ButtonUp extends MovieClip { public function new() { super(); } }
class ButtonOver extends MovieClip { public function new() { super(); } }
class ButtonDown extends MovieClip { public function new() { super(); } }
class Clippy {
// Main
static function main() {
var text:String = flash.Lib.current.loaderInfo.parameters.text;
// button
var button:SimpleButton = new SimpleButton();
button.useHandCursor = false;
button.upState = flash.Lib.attach("ButtonUp");
button.overState = flash.Lib.attach("ButtonOver");
button.downState = flash.Lib.attach("ButtonDown");
button.hitTestState = flash.Lib.attach("ButtonDown");
button.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent) {
flash.system.System.setClipboard(text);
});
flash.Lib.current.addChild(button);
}
}