Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package {
- import flash.events.*;
- import flash.display.*;
- import flash.external.*;
- import flash.system.*;
- import flash.utils.*;
- public class ZeroClipboard extends Sprite {
- private var button:Sprite;
- private var id:string = "";
- private var clipText:string = "";
- public function ZeroClipboard(){
- super();
- stage.scalemode = StageScaleMode.EXACT_FIT;
- Security.allowdomain("*");
- var flashvars:* = LoaderInfo(this.root.loaderInfo).parameters;
- id = flashvars.id;
- button = new Sprite();
- button.buttonMode = true;
- button.usehandcursor = true;
- button.graphics.beginfill(0xCCFF00);
- button.graphics.drawRect(0, 0, math.floor(flashvars.width), math.floor(flashvars.height));
- button.alpha = 0;
- addChild(button);
- button.addEventListener(MouseEvent.CLICK, clickHandler);
- button.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:Event){
- ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseOver", null);
- });
- button.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event){
- ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseOut", null);
- });
- button.addEventListener(MouseEvent.MOUSE_DOWN, function (_arg1:Event){
- ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseDown", null);
- });
- button.addEventListener(MouseEvent.MOUSE_UP, function (_arg1:Event){
- ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseUp", null);
- });
- ExternalInterface.addCallback("setHandCursor", setHandCursor);
- ExternalInterface.addCallback("setText", setText);
- ExternalInterface.call("ZeroClipboard.dispatch", id, "load", null);
- }
- public function setHandCursor(_arg1:boolean){
- button.usehandcursor = _arg1;
- }
- private function clickHandler(_arg1:Event):void{
- system.setclipboard(clipText);
- ExternalInterface.call("ZeroClipboard.dispatch", id, "complete", clipText);
- }
- public function setText(_arg1){
- clipText = _arg1;
- }
- }
- }//package
Add Comment
Please, Sign In to add comment