Skip navigation
Currently Being Moderated

Copy user-selected HTML textfield

Jul 13, 2012 8:59 AM

AS3 targeting Flash 9. Using regular old textfield with htmlText and a stylesheet. The text content has some links, bullets, bold, etc.

 

The user may want to select all or part of the text in the textfield and copy the text to paste into Word, email, etc.

 

As it is only the text gets copied and not the htmlText. But what I really want to do is do some formatting on the htmlText to make it more readable when they paste it into Word or e-mail. Like replace the <li> tags with bullets, display both the friendly text and the href for links, etc.

 

I've figure out how to use RegExp to format the entire htmlText into what I want on the clipboard and that all is working with a "copy" button.

 

But I want the user to also be able to use rightclick, menu, or keyboard commands.

 

First problem: Is there a way to detect rightclick copy event and/or menu copy event? I'm guessing the answer is no.

 

Second problem: Is there a way to align the selectionIndex with the htmlText?

 

Anyone have any clever ideas? Thanks.

 

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