Search code examples
imageactionscript-3apache-flexflex4

How to Add Multiple Images to Clipboard in as3 using Flex


I have this code:

mSelectedWidget = getWidgetsByID( mSelectedWidXML.children()[i].@id ) as DisplayObject;
mSelectedWidgetXML = (mSelectedWidget as IWidget).getWidgitPropXML();
var bmpData:BitmapData = new BitmapData(mSelectedWidget.width, mSelectedWidget.height);
bmpData.draw(mSelectedWidget);
Clipboard.generalClipboard.setData(ClipboardFormats.BITMAP_FORMAT, bmpData,false);

My Problem is that When i am copying multiple images, it is only copying last image (i.e which is added at last) to the clipboard.

I don't know how to add more than one images to clipboard at a time.

So I want the solution to add multiple images to clipboard.


Solution

  • Keyword = setData

    You're setting the data of the entire clipboard. It's not an array, so what you would want to do is either make one and give the user the ability to alternate through existing data, or merge any new images with the existing images.

    Disclaimer: Second option might not make the best panoramic!