Skip to main content
Oct 4, 2009 10:51 AM UTC
Question

How to get linkElement right after applyLink() function?

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 is closed to new replies. Start a new post to keep the conversation going.

2 replies

Adobe Employee
Oct 6, 2009 4:54 AM UTC

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

Translate
Oct 9, 2009 9:10 PM UTC

Thank you very much! It seems to be working!

Benjamin

Translate