Skip to main content
Inspiring
Jan 23, 2009 6:51 PM UTC
Answered

Pasting Text from Clipboard

I know there is a simple answer to this, but I cannot find it. The code I attached to this post yields a security error of the following nature:

SecurityError: Error #2179: The Clipboard.generalClipboard object may only be read while processing a flash.events.Event.PASTE event.

Thoughts anyone?
This topic is closed to new replies. Start a new post to keep the conversation going.
brian_thomas2
brian_thomas2Correct answer
Adobe Employee
Jan 26, 2009 6:57 PM UTC
Here is an explanation of how these restrictions work: User-initiated action requirements in Flash Player 10

5 replies

brian_thomas2
Adobe Employee
brian_thomas2Correct answer
Adobe Employee
Jan 26, 2009 6:57 PM UTC
Here is an explanation of how these restrictions work: User-initiated action requirements in Flash Player 10
Translate
Inspiring
Jan 26, 2009 7:35 PM UTC
Makes a whole lot of sense, especially from the security angle. I'm going to log a request for this to be officially evaluated. It should be expected, and certainly feasible without violating the security model, that when dealing with a text API that we should be able to work with clipboard contents. Perhaps consider restrictions that only allow text data into the component and rejecting binary data?

Expecting users to rely on keyboard shortcuts or context menus with my user base is kind of a mistake. It's simple enough for engineers but not so much for teachers. Yes, an oxymoron at its finest.

Translate
Inspiring
Jan 26, 2009 6:16 PM UTC
No. I do believe that clipboard access has to be specifically initiated via a user action.
Translate
Participating Frequently
Jan 24, 2009 4:32 AM UTC
Hi -

You don't say how your function is being called, but if it is being called independent of a flash.events.Event.PASTE event, you will get this error.

-Chris
Translate
Inspiring
Jan 26, 2009 4:10 PM UTC
It's being called as the event handler for button 'click' event. I understand that it will only execute within a paste event. My question is can I manually trigger a paste event? Does dispatchEvent("paste") work?

The objective is to have a paste toolbar icon. I've found in the past that much of our usage base doesn't have a strong grasp on the Ctrl+V / Cmd+V shortcut. Providing a visual button makes a lot of sense.
Translate