This content has been marked as final. Show 4 replies
You can copy to the clipboard with:
But I'm not sure if this can work with anything other than strings.
Another (maybe intermediary) way of doing it would be to export the vector graphics in the SVG text based format.
Thanks for the response. I agree that System.setClipboard is only useful for storing text.
I'm keen on the idea of writing an algorithm to convert my UIComponent's into a file in SVG (or maybe EPS) format. However, I find it surprising that no one's done this before.
If you use AIR, you can actually copy a bitmap to the clipboard. Of course, this is not as nice as using vector graphics.
You first have to capture your chart image.
var snapshot:ImageSnapshot = ImageSnapshot.captureImage(chartComponent);
Now, you can access the data property of the ImageSnapshot instance, which is of type ByteArray.
In order to copy a bitmap to the clipboard, you need to create an object of type BitmapData and set its pixels to the ByteArray you just got:
var bmp:BitmapData = new BitmapData();
// rect is of type Rectangle. It is the bitmap boundaries
Finally, you can set the clipboard with the bitmap data:
Does this work if you are just using Flex (not AIR)?