Skip to main content
October 4, 2009
Question

How to get linkElement right after applyLink() function?

  • October 4, 2009
  • 1 reply
  • 813 views

Hi all,

I am working on a Rich Text Editor. I need to have link insertion, but a custom one.


I want to find the linkElement which was just created (or created before, but the selection od EditorManager points to the link) in order to:

-handle the linkElement mouse interactions

-passing custom variable with setStyle

So the code is like this:

editor.applyLink( "event:click" );
var element:LinkElement = ????;
element.addEventListener(FlowElementMouseEvent.CLICK, handler);

Thanks,

Benjamin

This topic has been closed for replies.

1 reply

Adobe Employee
October 6, 2009

You could try this:

editor.applyLink( "event:click" );

var leaf:FlowLeafElement = editor.textFlow.findLeaf(editor.absoluteStart);

var element:FlowElement = leaf.parent;

while (element & !(element is LinkElement))

{

     element = element.parent;

}

element.addEventListener(FlowElementMouseEvent.CLICK, handler);

This is coded up on the fly, so it may not work out of the box, but should point you in a direction that will work.

- robin

October 9, 2009

Thank you very much! It seems to be working!

Benjamin