Save Flex chart as image
Sometime we want to export the charts generated in Adobe Flex to an image. In this article we would learn how we can export Adobe Flex UIComponent to image(JPEG) from your flex application.
public static function exportChartImage(obj:UIComponent):void { try{ var file:FileReference = new FileReference(); var bmpd:BitmapData = new BitmapData(obj.width, obj.height); bmpd.draw(obj); var jpgenc:JPEGEncoder = new JPEGEncoder(80); var imgByteArray:ByteArray = jpgenc.encode(bmpd); file.save(imgByteArray,"chart.jpg"); } catch(e:Error){} } |
Recent Comments