package
{
import flash.display.*;
import flash.events.*;
import flash.external.*;
import flash.system.*;
public class ZeroClipboard extends Sprite
{
private var button:Sprite;
private var id:String = "";
private var clipText:String = "";
public function ZeroClipboard()
{
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(13434624);
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 (event:Event)
{
ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseOver", null);
return;
}// end function
);
button.addEventListener(MouseEvent.MOUSE_OUT, function (event:Event)
{
ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseOut", null);
return;
}// end function
);
button.addEventListener(MouseEvent.MOUSE_DOWN, function (event:Event)
{
ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseDown", null);
return;
}// end function
);
button.addEventListener(MouseEvent.MOUSE_UP, function (event:Event)
{
ExternalInterface.call("ZeroClipboard.dispatch", id, "mouseUp", null);
return;
}// end function
);
ExternalInterface.addCallback("setHandCursor", setHandCursor);
ExternalInterface.addCallback("setText", setText);
ExternalInterface.call("ZeroClipboard.dispatch", id, "load", null);
return;
}// end function
public function setHandCursor(param1:Boolean)
{
button.useHandCursor = param1;
return;
}// end function
private function clickHandler(event:Event) : void
{
System.setClipboard(clipText);
ExternalInterface.call("ZeroClipboard.dispatch", id, "complete", clipText);
return;
}// end function
public function setText(param1)
{
clipText = param1;
return;
}// end function
}
}
|