Skip to main content
Participant
Mar 2, 2009 4:24 PM UTC
Question

getClipboardContents

I use next code:
public function doPaste():void
{
var ts:TextScrap = SelectionManager(_textFlow.interactionManager).getClipboardContents();
SelectionManager(_textFlow.interactionManager).pasteTextScrap(ts);
}

and i got security error:
SecurityError: Error #2179: Объект Clipboard.generalClipboard может считываться только при обработке события flash.events.Event.PASTE.
at flash.desktop::Clipboard/getObjectReference()
at flash.desktop::Clipboard/convertNativeFormat()
at flash.desktop::Clipboard/getOriginal()
at flash.desktop::Clipboard/getData()
at flashx.textLayout.edit::TextClipboard/get textScrap()
at flashx.textLayout.edit::SelectionManager/getClipboardContents()
Sorry, it is russian

any ideas?
This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

AcidlexAuthor
Participant
Mar 3, 2009 7:56 AM UTC
ok.
So I can set clipboard, but cant read. Becouse next code works.
public function doCopy():void
{
var sm:SelectionManager= new SelectionManager();
var ts:TextScrap = SelectionManager(_textFlow.interactionManager).createTextScrap();
SelectionManager(_textFlow.interactionManager).setClipboardContents(ts);
}

My task is a buttons with copy, cut, paste fucntions. Everything works except paste. :(

I used this resource as example http://livedocs.adobe.com/flex/gumbo/langref/flashx/textLayout/edit/SelectionManager.html
there is an example of copy and paste operations.
Translate
brian_thomas2
Adobe Employee
Adobe Employee
Mar 2, 2009 9:59 PM UTC
For security reasons clipboard interaction must be performed within a user initiated copy/paste event, otherwise you will see this error.

See User-initiated action requirements in Flash Player 10 for an explanations of the security requirements.
Translate
Mar 2, 2009 9:58 PM UTC
I'm fairly certain that this is because you can only read the system clipboard while handling an Event.PASTE event, which is an event that is built into the flash player. This is a fairly basic security restriction with Flash Player 10.

There is some more info on it here: http://www.adobe.com/devnet/flashplayer/articles/fplayer10_uia_requirements.html
Translate