Guest User

Untitled

a guest
Aug 3rd, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     package {
  2.     import flash.events.*;
  3.     import flash.display.*;
  4.     import flash.external.*;
  5.     import flash.system.*;
  6.     import flash.utils.*;
  7.      
  8.     public class ZeroClipboard extends Sprite {
  9.      
  10.     private var button:Sprite;
  11.     private var id:string = "";
  12.     private var clipText:string = "";
  13.      
  14.     public function ZeroClipboard(){
  15.     super();
  16.     stage.scalemode = StageScaleMode.EXACT_FIT;
  17.     Security.allowdomain("*");
  18.     var flashvars:* = LoaderInfo(this.root.loaderInfo).parameters;
  19.     id = flashvars.id;
  20.     button = new Sprite();
  21.     button.buttonMode = true;
  22.     button.usehandcursor = true;
  23.     button.graphics.beginfill(0xCCFF00);
  24.     button.graphics.drawRect(0, 0, math.floor(flashvars.width), math.floor(flashvars.height));
  25.     button.alpha = 0;
  26.     addChild(button);
  27.     button.addEventListener(MouseEvent.CLICK, clickHandler);
  28.     button.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:Event){
  29.     ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseOver", null);
  30.     });
  31.     button.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:Event){
  32.     ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseOut", null);
  33.     });
  34.     button.addEventListener(MouseEvent.MOUSE_DOWN, function (_arg1:Event){
  35.     ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseDown", null);
  36.     });
  37.     button.addEventListener(MouseEvent.MOUSE_UP, function (_arg1:Event){
  38.     ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseUp", null);
  39.     });
  40.     ExternalInterface.addCallback("setHandCursor", setHandCursor);
  41.     ExternalInterface.addCallback("setText", setText);
  42.     ExternalInterface.call("ZeroClipboard.dispatch", id, "load", null);
  43.     }
  44.     public function setHandCursor(_arg1:boolean){
  45.     button.usehandcursor = _arg1;
  46.     }
  47.     private function clickHandler(_arg1:Event):void{
  48.     system.setclipboard(clipText);
  49.     ExternalInterface.call("ZeroClipboard.dispatch", id, "complete", clipText);
  50.     }
  51.     public function setText(_arg1){
  52.     clipText = _arg1;
  53.     }
  54.      
  55.     }
  56.     }//package
Add Comment
Please, Sign In to add comment