1 Reply Latest reply on Jun 3, 2008 3:14 PM by Schdeffan

    Flex/AS3: textArea - Paste-Event

    Schdeffan Level 1
      Hi everyone,

      is there a way to capture the paste in the mx:TextArea? KEY_DOWN captuing for V with event.command == true (I'm on a Mac) does not work.

      Stephan
        • 1. Re: Flex/AS3: textArea - Paste-Event
          Schdeffan Level 1
          To answer my own question, I finally found a solution ...

          While there isn't any paste event you can catch a menu command invokation for paste of a native menu. You need to add an event listener for the SELECT event to the native menu.

          Then you can either handle the paste yourself or call standard functionality by invoking nativeApplication.paste()

          You need a native edit (normally with at least cut, copy, paste, select all) menu for that, preferrably with the common key short cuts. It is automatically created on the Mac but you have to create it yourself for Windows (haven't tried Linux yet, but I'm sure you'll need to create it there as well).

          By creating your own menu, especially on windows (where you have to), you cut off all standard behaviour for cut, copy, paste and select all, so you have to call the according methods of nativeApplication yourself. If you reuse the standard edit menu that's created automatically on OS X you do not need to do that.

          Hope this helps anyboy with the same problem