Skip to main content
October 1, 2009
Question

How to define current flow element and more

  • October 1, 2009
  • 1 reply
  • 657 views

Hi all. I've just started with text layout and I have a lot of questions, will be thankfull if smbdy can help me.

1. How can I get the flow element according to mouse position over it, for exmple highlight the paragraph element on mouse over.

2. How to implement drag&drop behavior to text flow elements, for example for images.

3. How can I get the element in which the blinky "add text here icon" is located?

Thanks.

This topic has been closed for replies.

1 reply

Adobe Employee
October 2, 2009

1. How can I get the flow element according to mouse position over it, for exmple highlight the paragraph element on mouse over.

Probably the most efficient way is to listen for the updateComplete from the TextFlow, and when it comes walk the flowComposer's TextFlowLines for each paragraph to get the paragraph bounds. Once you have a list of bounds, doing the roll over on mouse move should be very quick.

2. How to implement drag&drop behavior to text flow elements, for example for images.

Good question. The container that holds the text will be getting events for mouse down, mouse move, etc. and handles them by passing them along to the interactionManager (class name SelectionManager). The interactionManager handles them by making a text selection. If you want to handle the mouseUp by inserting the image at the selection, that should be pretty simple. There's a method for that in IEditManager (the interactionManager is also an IEditManager), so you can just call interactionManager.insertInlineGraphic.

3. How can I get the element in which the blinky "add text here icon" is located?

Easiest way is to call

     ElementRange.createElementRange(textFlow, textFlow.interactionManager.absoluteStart, textFlow.interactionManager.absoluteEnd);

That creates an element range which will have the leaf and paragraph elements in the selection.

Hope this helps,

- robin

October 2, 2009

thanks, i'll post the code after getting some results.