0
A
回答
0
你可以試試這樣
//go to target frame
mc.gotoAndStop(1);
//the area you want to draw
var area:Rectange = new Rectange(50, 60, 100, 200);
if (mc.width != 0 && mc.height != 0) {
//draw the mc on the target frame
var temp:BitmapData = new BitmapData(mc.width, mc.height, true, 0x00000000);
temp.draw(mc);
//target area bitmapdata
var targetBD:BitmapData = new Bitmapdata(area.width, area.height, true, 0x00000000);
targetBD.copyPixels(temp, area, new Point(0, 0));
//draw to shape
shape.graphics.beginBitmapFill(targetBD);
shape.graphics.drawRect(0, 0, area.width, area.height);
shape.graphics.endFill();
}
您可以撥打的BitmapData dispose方法來清洗的BitmapData,它會釋放用來存儲BitmapData對象的內存。
+0
dispose不會使它成爲新創建,但破壞它,並可能導致unnececerry垃圾收集 - 如果你需要重用「畫布」,你不妨使用'myBitmapData.fillRect(myBitmapData.rect,INIT_COLOR);'這裏INIT_COLOR與創建位圖或任何東西,當你想作爲背景使用使用的相同的帆布。 –
+0
@Lukasz我覺得他的明確意思是釋放內存,所以我建議他用處理功能。而我通常使用的BitmapData位圖,在大多數情況下使用BitmapData不會改變,所以才稱之爲bitmap.bitmapdata = NULL。 – Pan
相關問題
- 1. 如何從一個影片剪輯
- 2. 在影片剪輯使用了lineTo有一些形狀已經
- 3. WPF剪輯矩形
- 4. WPF剪輯形狀
- 5. AS3:確保孩子們保持父影片剪輯的形狀
- 6. 如何從ref影片剪輯中移動影片剪輯
- 7. 如何訪問AS3中另一個影片剪輯中的影片剪輯?
- 8. AS2:一個影片剪輯
- 9. 禁用ie8剪輯矩形
- 10. 剪輯矩形用C#
- 11. 在XAML中使用矩形形狀作爲剪輯
- 12. 在AS3中複製影片剪輯
- 13. 將多個形狀和組轉換爲Flash CS5中的影片剪輯/符號
- 14. 將多個影片剪輯合併成一個單獨的影片剪輯
- 15. 如何從庫中一類添加一個影片剪輯
- 16. 如何平均一個3D矩陣的片保持其形狀
- 17. 如何將形狀從一張幻燈片複製到另一張幻燈片?
- 18. 如何繪製System.Drawing.Bitmap形狀的投影?
- 19. 如何從矩形疊加裁剪uiimageView?
- 20. 如何從tiff剪短矩形?
- 21. hitTestObject,stopDrag停止兩個影片剪輯拖即使功能狀態一個影片剪輯停止拖動
- 22. 可能從另一個影片剪輯控制movieclip組件?
- 23. 圖片動畫:從一個圓形到一個矩形。 (with corner.js)
- 24. 定製邊界矩形的形狀
- 25. AS3確定是否影片剪輯罷了另一個影片剪輯完全
- 26. 如何創建從一個形狀到另一個形狀的變形效果?
- 27. 如何將addChild添加到影片剪輯的位圖中的影片剪輯
- 28. 如何在Android中將矩形形狀添加到矩形形狀
- 29. Powerpoint編輯如何從一張幻燈片複製一個形狀到另一張
- 30. 重複的影片剪輯中AIR/AS3
你是什麼意思明確:),你是什麼意思一個區域:) –
清除所有像素,並使其作爲新創建 – simo