0
在AIR/AS3 Flex Mobile for Android項目中。在AIR/AS3中如何捕獲舞臺上可見內容的圖像並將該圖像保存爲任何類似jpg/pdf的文件
我如何能捕捉在視圖中看到什麼的「形象」
那麼像只保存爲JPG格式一樣/ PDF到SD卡什麼?
基本上使用AS3的Android屏幕截圖。
在AIR/AS3 Flex Mobile for Android項目中。在AIR/AS3中如何捕獲舞臺上可見內容的圖像並將該圖像保存爲任何類似jpg/pdf的文件
我如何能捕捉在視圖中看到什麼的「形象」
那麼像只保存爲JPG格式一樣/ PDF到SD卡什麼?
基本上使用AS3的Android屏幕截圖。
private function getBitmapData(target:DisplayObject) : BitmapData
{
//target.width and target.height can also be replaced with a fixed number.
var bd : BitmapData = new BitmapData(target.width, target.height);
bd.draw(target);
return bd;
}
使用JPEGEncoder
創建字節數組並將其保存到您的SD卡。在某些情況下,如果目標的寬度和高度不起作用,則可以使用getbounds
方法獲取對象的邊界,並從邊界取width
和height
。
你能舉一個完整的例子來說明如何做到這一點嗎?我一直在嘗試這個代碼無濟於事。 – 2012-09-24 17:22:02
getBitmap(yourViewObjectReference)這將做的伎倆 – Triode 2012-09-25 04:52:39