Skip to main content
Participating Frequently
December 6, 2010
Question

Paste text programmatically.

  • December 6, 2010
  • 1 reply
  • 679 views

Hello. I know that paste operaion can be performed only by user interaction (via context menu or by cntrl+V combination). But there're some confusing description of the Event.PASTE type:

'TextField objects always include Cut, Copy, Paste, Clear, and Select All commands in the context menu. You cannot remove these commands from the context menu for TextField objects. For TextField objects, selecting these commands (or their keyboard equivalents) does not generate clear, copy, cut, paste, or selectAll events. However, other classes that extend the InteractiveObject class, including components built using the Flash Text Engine (FTE), can dispatch these events.'

So, somehow I can dispatch paste event and it's possible to insert text programmatically? But how?

This topic has been closed for replies.

1 reply

Adobe Employee
December 6, 2010

You can dispatch the commands, but in a browser context the Player will throw a security violation when it gets them. It works fine in AIR, or if the user has explicitly allowed local access (i.e., disabled security).

To be very clear, what fails is the access to the external system clipboard. If you wanted to create a TextScrap explicitly and paste it, that would work fine. But normally copy & paste is between applications, in which case it requires access to the clipboard.

- robin

Participating Frequently
December 7, 2010

Yeah, thanks. I was interesting exactly in accessing external clipboard. But anyway description in documentation is confusing.