Copy link to clipboard
Copied
Is it possible to paste image from clipboard using ActionScript 3 and Flash Player 11?
Need web solution only, not AIR.
Use case:
- User opens image some in some native image editor.
- Selects part of image and clicks Ctrl+C (Command+C on Mac). Now part of image is in clipboard.
- User open web application that is running in Flash Player
- User inputs image by clicking Ctrl+V (Command+V on Mac) or using context Menu->Paste.
I browsed the docs for Clipboard at: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/Clipboard.html
The only format that seems reasonable would be Clipboard.getData(BITMAP_FORMAT) on paste events. This seems to be supported by AIR only.
Are there any ways to implement the given use case with Flash Player?
Thanks!
P.S.: There is some support of paste events in HTML in Chrome and Firefox, but Internet Explorer 10 and Apple Saffari 6 seems still have issues with pure-HTML approach.
--
Cheers,
Ignat.
Copy link to clipboard
Copied
This seems to be supported by AIR only.
What gives you the impression?
AIR-only functions are marked with a fancy AIR logo
(like the first one in this list: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/images/sprite-index.png )
and getData doesn`t have it, so it should work without problems in the "normal" Flash Player if you follow the recepy:
Note for Flash Player applications: In Flash Player 10, a paste operation from the clipboard first requires a user event (such as a keyboard shortcut for the Paste command or a mouse click on the Paste command in a context menu).
Clipboard.getData()
will return the contents of the clipboard only if the InteractiveObject has received and is acting on a paste event. CallingClipboard.getData()
under any other circumstances will be unsuccessful.
Copy link to clipboard
Copied
Thanks for your reply.
These user events is exactly I'm working on. Can I receive an image data on paste events in Flash Player?
I managed to receive only text data.
I wonder if ActionScript has support for image objects?
--
Cheers, Ignat.
Copy link to clipboard
Copied
Sorry, i didn`t see this restriciton, makes sense, otherwise a flash hack could easily transfer a screenshot of your desktop to a server. So no way around that I guess.
Copy link to clipboard
Copied
I woudn't call it a 'hack' as long as Flash should have access to clipboard on the following restrictions:
1) The image should be already in clipboard
2) The data should be only available on paste handler (as you mentioned).
So I wonder why doesn't it work with Flash Player?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now