2012-03-01 37 views

回答

3
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方法獲取對象的邊界,並從邊界取widthheight

+0

你能舉一個完整的例子來說明如何做到這一點嗎?我一直在嘗試這個代碼無濟於事。 – 2012-09-24 17:22:02

+1

getBitmap(yourViewObjectReference)這將做的伎倆 – Triode 2012-09-25 04:52:39

相關問題