Reputation: 48
I want to be able to send text and pictures to clipboard.
How can you convert a bitmap so it can be in the clipboard with RICH_TEXT_FORMAT later I will add text
Upvotes: 0
Views: 435
Reputation: 533
You use the BITMAP_FORMAT format type and pass as Object a BitmapData; the 3rd argument is whether the data should be serializeable (for use in another AIR app) - the function signature is:
public class Clipboard
{
public function setData(format:String, data:Object, serializable:Boolean = true):Boolean
}
... in context:
var bitmapData:BitmapData = new BitmapData(400, 50, false, 0);
bitmapData.perlinNoise(10, 50, 3, (Math.random() * 255) | 0, true, true);
Clipboard.generalClipboard.clear();
Clipboard.generalClipboard.setData(ClipboardFormats.BITMAP_FORMAT, bitmapData, false);
... run then paste in any graphics editor.
Upvotes: 1