Skip to main content
Participating Frequently
February 13, 2012
Question

Why when i paste an image in a textflow it adds the text image name too?

  • February 13, 2012
  • 1 reply
  • 2063 views

Hi,

I'm trying to solve this behaviour:

I copy an image in my desktop with CTRL+C/CMD+C.

Then in my application I paste the image in the textflow with CTRL+V/CMD+V... but it adds the image and the image name (as text), instead I want it adds only the image!

So, I'm listening the Event.PASTE event and get image from Clipboard.

I save the file in the FILE_LIST_FORMAT in an object and I try reset other formats, like TEXT_FORMAT, where Clipboard store my image name...

but nothing change.

Do you have any suggestion please?

Thanks!

This topic has been closed for replies.

1 reply

casper_no
Known Participant
February 13, 2012

You might be able to handle it by listening for the paste event in the textFlow

          myTextFlow.addEventListener(FlowOperationEvent.FLOW_OPERATION_BEGIN, handleFlowEvents);

...

private function handleFlowEvents(e:FlowOperationEvent):void {

                              if (e.operation is PasteOperation) {

                                             trapPaste(e.operation as PasteOperation);

                              }

}

And then manipulate the PasteOperation in trapPaste()