↓4kのFlash ボタンを使っています
package {
import flash.display.*;
import flash.events.*;
import flash.external.*;
import flash.system.*;
// 背景色
[SWF(width="85",height="17",backgroundColor="#FFFFFF")]
// 表示用クラス 【Sprite】を継承
public class clipboard2 extends Sprite {
[Bindable]
[Embed("button.gif")]
private var imgMail:Class;
// *********************************************************
// コンストラクタ
// *********************************************************
public function clipboard2():void {
// stage の設定
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
// マウスイベント取得用
var eventArea:Sprite = new Sprite();
eventArea.x = 0;
eventArea.y = 0;
eventArea.buttonMode = true; // ハンドカーソル
addChild(eventArea);
// 画像
var myImg:Bitmap = new imgMail();
myImg.x = 0;
myImg.y = 0;
eventArea.addChild(myImg);
eventArea.addEventListener(MouseEvent.CLICK,
function(ev:flash.events.MouseEvent):void {
var strid:String = ExternalInterface.objectID;
strid = strid.replace(/flash_btn/g, '');
var shift_flg:String;
if ( ev.shiftKey ) {
shift_flg = "1";
}
else {
shift_flg = "0";
}
var str:String =
ExternalInterface.call(
"orgCodeGetForClipcopy",
"pre"+strid,
shift_flg
);
if ( str != null && str != "" ) {
System.setClipboard(str);
ExternalInterface.call("orgCodeClipcopyEnd" );
}
ExternalInterface.call("console.log", str);
}
);
}
}}