Skip to main content
Participating Frequently
Oct 19, 2009 4:10 PM UTC
Question

What does PasteOperation insert?

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 is closed to new replies. Start a new post to keep the conversation going.

4 replies

Adobe Employee
Oct 26, 2009 10:23 PM UTC

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.

Translate
Participating Frequently
Oct 29, 2009 1:03 PM UTC

Thanks for the feedback,

Marc

Translate
Participating Frequently
Nov 4, 2009 12:46 PM UTC

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;
            }
           
        }

Translate