Skip to main content
Known Participant
January 19, 2011
Question

Preventing default mouse cursor hovering link

  • January 19, 2011
  • 1 reply
  • 1196 views

Hello there,

Is it possible to prevent mouse cursor default behavior - changing to hand cursor - while hovering over the link in RichEditableText?

It may sound strange, but for the specific design purposes I need to be able temporarily disable this default behavior.

CursorManager doesn't seem handle this. I tried to place sort of a shield over the link - the graphic primitive Rect, but smart mouse still detects the coordinates of the link and changes to hand cursor.

Any suggestions?

Thanks,

FTQuest

This topic has been closed for replies.

1 reply

Adobe Employee
January 20, 2011

There are two ways I can think of to do this. First way is to register for link events (see FlowElementMouseEvent), and when you get a link event that would normally change the mouse cursor, you can override it it in your event handler by resetting the container's useHandCursor flag. You may get a flicker, I don't know, as it gets turned on & turned off again, but I think it should work in either TLF 1.0 or TLF 2.0.

In TLF 2.0, the ContainerController has a mouseEventManager that will be called to reset the cursor state. In TLF 2.0, you can supply your own ContainerController that comes with its own mouseEventManager, and the mouseEventManager you supply can have a different policy about when the hand cursor is set.

- robin

FTQuestAuthor
Known Participant
January 20, 2011

Hello Robin,

Thank you for the suggestions.

It was my first thought/attempt to use one of the flags related to handCursor, but none of those, including 'useHandCursor' being set for RichEditableText in the event listener for FlowElementMouseEvent worked.

So, I ended up using the combination of two flags: mouseEnabled and mouseChildren. Only together they override stubborn default.

As to the second way that you suggested - "In TLF 2.0, the ContainerController has a mouseEventManager" - I couldn't find in the documentation on ContainerController such property.

Taking advantage of communicating with you, I'd like to ask another question (albeit, it would be more appropriate to do it in a separate post): could you recommend the way to get the x y coordinates of the LinkElement that has been clicked?

Currently, I'm trying the following:

in the the event listener function for the FlowElementMouseEvent I read the value from: event.originalEvent.localX(or stageX/Y).

Is this reasonable, or there are better ways?

Given that my RichEdText is in the Scroller, interpreting the numbers is a bit tricky.

Thank you very much,

Igor Borodin

Adobe Employee
January 20, 2011

There is no documentation on this class (it isn't part of our public API), but you can find it by looking through the source code.

Your method for getting the mouse click location is basically correct. The MouseEvent has the location available either in stage coordinates, or local coordinates. For your purposes you may find it more convenient to look at the local coordinates (localX and localY).

- robin