[code]
package
{
import flash.desktop.Clipboard;
import flash.desktop.ClipboardFormats;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.external.ExternalInterface;
import flash.net.URLRequest;

/**
* …
* @author amyflash.com
*/
public class Main extends Sprite
{
public var imgLoad:Loader;
public var paramObj:Object;
public var copyCon:String;
public var btnURI:String;
public var imgReq:URLRequest;
public var sp:MovieClip;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}

private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
this.paramObj = LoaderInfo(this.root.loaderInfo).parameters;
this.copyCon = String(this.paramObj[“content”]);
this.btnURI = “clipboard.png”;
this.imgReq = new URLRequest();
this.imgLoad = new Loader();
this.sp = new MovieClip();
this.imgReq.url = this.btnURI;
this.imgLoad.load(this.imgReq);
addChild(this.sp);
var _loc_1:int = 0;
this.sp.y = 0;
this.sp.x = _loc_1;
this.sp.buttonMode = true;
this.sp.addChild(this.imgLoad);
this.sp.addEventListener(“mouseOver”, this.styleChange);
this.sp.addEventListener(“mouseOut”, this.styleBack);
this.sp.addEventListener(“click”, this.copyContent);

}

public function copyContent(event:MouseEvent):void
{
Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, this.copyCon);
if(ExternalInterface.available)
ExternalInterface.call(“alert”,”copy success!”);
return;
}// end function

public function styleChange(event:MouseEvent):void
{
event.target.alpha = 0.8;
return;
}// end function
public function styleBack(event:MouseEvent):void
{
event.target.alpha = 1;
return;
}// end function
}

}
[/code]

例子下载
说明:index.html中的flashvars里的粗斜体部分替换成自己的页面内容即可
var flashvars = {“content”:”copy content!“};