Skip to main content
Participating Frequently
October 19, 2009
Question

What does PasteOperation insert?

  • October 19, 2009
  • 1 reply
  • 882 views

I want to modify the pasted content in different ways like linking URLs, removing tabs, etc. However I've not found a way to get pasted content.

When listening to FlowOperationEvent.FLOW_OPERATION_END, I can retrieve PasteOperation and pasteOperation.absoluteStart but not the end of the pasted content. pasteOperation.absoluteEnd points to the end before the paste operation. PasteOperation._numCharsAdded looks promising but it's private.

Any ideas appreciated...

Marc

This topic has been closed for replies.

1 reply

Adobe Employee
October 26, 2009

Hmm... you should be able to access this info from the operation, but you're right, I don't see a good way to do that in the public namespace. I will write this up as a bug. In the meantime, you could check the textFlow length in the FLOW_OPERATION_BEGIN and compare it to the textLength in the FLOW_OPERATION_END, and that should give you the amount added.

Participating Frequently
October 29, 2009

Thanks for the feedback,

Marc

Participating Frequently
November 4, 2009

What does your event handler look like?

The FlowOperationEvent has an operation property of type FlowOperation but how are you casting that into a PasteOperationEvent?  Are you just using a try/catch or is there a more elegant way you are doing this?

I am just doing the following:

        private function flowBeginHandler(event:FlowOperationEvent):void
        {
            var flowOperation:FlowOperation = event.operation;
            var operationType:String = flash.utils.getQualifiedClassName(flowOperation).split("::")[1];
           
            switch(operationType)
            {
                case PasteOperation:
                    trace("Paste handling logic");
                    break;
            }
           
        }