Skip to main content
August 18, 2009
Question

textflow word right click

  • August 18, 2009
  • 1 reply
  • 3488 views

Hi,

I am using TLF in my application. the textflow contains text & inlinegraphics. I am trying to implement spell checker on my own. So I want to add the suggested words for the miss-spelt word. For that I want to know the word I have right cliked on. After that fetching it from library & getting the suggested words part is done.

So I need to add a right click event to the miss-spelt words and to know the word I have to look for(the word on which I have right clicked).

Thanks in advance.

This topic has been closed for replies.

1 reply

Adobe Employee
August 19, 2009

By default right click brings up the contextMenu.  I didn't find how to suppress the contextMenu on a given Sprite and then handle the right mouse event.  Might want to ask on a Flash forum.

One possibility: subclass ContainerController and override createContextMenu to create a custom contextMenu that is populated with spelling corrections.

Hope that helps,

Richard

August 19, 2009

Hi rdermer,

I don't want to suppress contextMenu and my requirement is the one possibility suggested by you. I need that only. But I am not able to get the word on which I have right clicked.

Also if the cursor is blinking some where else and I do right click some where else then I need the cursor to blink at the place where I have right clicked.

Just like MS Word.

Participating Frequently
August 19, 2009

Hi,

There are many ways to find the word which has been right-clicked but they all involve many steps. I've outlined one such way:

- Get the TextLine instance at which right click occured: Iterate through all text lines, get their bounds and check if the point at which the right-click occured falls in those bounds

- Once you have the target TextLine, iterate through all its atoms, get their bounds and check if the  point at which the right-click occured falls in those bounds.

- Once you have the target atom, use the ParagraphElement methods findNextWordBoundary and findPreviousWordBoundary to get the word.

Abhishek

(Adobe Systems Inc.)