Copy link to clipboard
Copied
Flash says I can only use the Clipboard.getData only in a PASTE event. (CS4 & AS3)
But I don't know how to make a paste event? Can someone help me out?
Copy link to clipboard
Copied
Use
System.setClipboard( strToCopy )
Copy link to clipboard
Copied
I want to access the clipboard to get the text out of it. I can already do it in AIR but to do it in a swf it needs to happen in a paste event.
But I don't know how to make a PASTE event..
function onPasteMessage(event:Event) {
trace("lol");
}
myTextField.text = "LOL";
myTextField.addEventListener(Event.PASTE, onPasteMessage);
I tried that code with an textfield called myTextField on the stage, but when I rightclick and select Paste nothing happens.
Copy link to clipboard
Copied
First make sure that type of the tet field is "input". Programmatically is can be done:
myTextField.type = TextFieldType.INPUT;
Once it is done - it will show OS context menu (Copy, Paste, etc.)
According to documentation TextField doesn't dispatch Event.PASTE. Read this:
http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/events/Event.html#PASTE
If you want to detect changes in the TextField you may want to listen to Event.CHANGE.
Copy link to clipboard
Copied
No one kows this? Because Flash says I can only do it within a PASTE event, so there should be a way to make a paste event right?
Copy link to clipboard
Copied
I'd see it as a security breach if any app on the interwebs could read my clipboard without me going Ctrl/Cmd-V...
No tellin' what's on the clipboard: passwords, CC numbers etc.
In other words, I would not be surprised if it was not possible.
Copy link to clipboard
Copied
Yeah but read this:http://drawlogic.com/2008/09/28/flas...save-and-load/
It says: the new ActionScript 3.0 method Clipboard.generalClipboard.getData() may be used to read the contents of the system Clipboard, but only when it is called from within an event handler processing a flash.events.Event.PASTE event.
And even Flash itself says: you can only do this within a Paste event.. so it IS possible?
Copy link to clipboard
Copied
I've not tested it, but I suppose it is only possible when processing a PASTE event like the docs say. You cannot 'create' such an event. The user must explicitly do so by Ctrl-V or whatever.
Just like an ordinary KeyboardEvent. You cannot generate it by code, the user must press a key. You can call an eventhandler meant to handle keyboard event, but there won't be an actual KeyboardEvent in that case.
Copy link to clipboard
Copied
So how am I going to do that? I've already put an PASTE event handler on a textfield but if I rechtclick > paste or ctrl+v it doesn't work.Help me please.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more