Skip navigation
Currently Being Moderated

Adobe flex copy paste htmlText into a text area

May 22, 2013 1:24 PM

I've a textArea1, i'm copying htmlText from a differant textArea2 to the current text area, it bring the formatting of the textArea2, that is ok, when I clear the textArea1 text, when I start typing, i still get the same format of the textArea2, how do i know what was pasted into the textArea? i've tried paste event, it did not trigger any thing.

What i'm trying to acheive is, try to find out what was pasted here, if the style of the text that is pasted is differant, then try to update the styles to the original. HOw to acheive this?

Thanks.

 
Replies
  • Currently Being Moderated
    Jun 20, 2013 3:10 PM   in reply to saisri2k2

    The TextArea has a changing event, the event type is a TextOperationEvent.

    The event has a property called operation.  This operation can be many things, like an InsertTextOperation if they are typing, or a PasteOperation if they are pasting.

    The operation also has a textflow property on it as well, but in this case the PasteOperation has a property called textScrap, and this has a textFlow of the text that is being pasted in.  So you should have access to any styles coming in with the text.

     

    Just a simple code snippet. 

     

    private function handler_textChange(event:TextOperationEvent):void

    {

         //see if action was cause of a paste

         if(event.operation is PasteOperation)

         {

              //do what you need with the text flow object.

              (event.operation as PasteOperation).textScrap.textFlow ........

         }

    }

     

    Hope that helps out.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points