Event listener to InLineGraphicElement
Hi,
Is there a way to add an event listener to InLineGraphicElements so I can detect when they are deleted using the "delete" key.
Thanks.
Hi,
Is there a way to add an event listener to InLineGraphicElements so I can detect when they are deleted using the "delete" key.
Thanks.
If all changes to the TextFlow are going through the IEditManager API (as for, example, with the delete key), you could add a listener for FlowOperationEvent.FLOW_OPERATION_BEGIN. The event will have the operation that is about to be done. If the operation is a DeleteTextOperation, you could scan the area of the TextFlow that is about to be deleted looking for InlineGraphicElements. Then you can do whatever bookkeeping you need *before* the InlineGraphicElement gets removed.
The DamageEvent idea would work also, but might be a little trickier. This is what I would suggest if you are trying to catch programmtic changes to the TextFlow that you don't have any control over and that go directly to the FlowElements. Do an addEventListener to the TextFlow looking for DamageEvents. Each DamageEvent will have inside it the range of text that was damaged. If you know where the InlineGraphicElements are, then when you see a DamageEvent that intersects the area, you could check to see if the InlineGraphicElement has been removed.
Hope this helps,
- robin
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.