1. 程式人生 > >通過影片剪輯去載入快取中的二維碼

通過影片剪輯去載入快取中的二維碼

    想要通過影片剪輯來載入一張圖片,可以先在flash中建立一個空的mc,然後通過load

    photoengine設定圖片大小(需要imput photo包)

    onLoadInit設定mc的屬性,以便在載入時調整大小

    loadClip 載入mc

    addListener() 方法偵聽mc的載入

var thumbListener:Object = new Object ();
thumbListener.onLoadInit = function (target_mc:MovieClip)
{
        QR._x= 820;    //QR_code pos
	QR._y= 286;
	target_mc._width = 274;    //QR_code size
	target_mc._height = 274;
};
var mc_loader:MovieClipLoader=new MovieClipLoader();
mc_loader.addListener(thumbListener);

...

function showQRcode()
{
	var hp_url:String = "/tmp/tmp_qrcode.jpg";

	if(QR_open == 0){
		QR_open = 1;
		PhotoEngine.Open();
	}
	trace("show QR photo !!!!!!!!!!!!!!!!!!");
	PhotoEngine.SetPlayRatio(PhotoEngine.PE_RATIO_ACTUAL_SIZE); //set photo's ratio
	mc_loader.loadClip(hp_url, QR);
}