快照后保存图片

1.var displayObject:DisplayObject = stage;   
2.var bitmapData:BitmapData = new BitmapData(displayObject.width,displayObject.height,true,0xffffff);   
3.bitmapData.draw(displayObject);                
4.var bitmap:Bitmap = new Bitmap(bitmapData);                
5.var png:PNGEncoder = new PNGEncoder();   
6.var pngStream:ByteArray = png.encode(bitmapData);   
7.var f:File = File.desktopDirectory;   
8.f = new File(f.resolvePath("a.png").nativePath);   
9.f.save(pngStream,"a.png"); 

 

你可能感兴趣的:(F#)