Skip to main content
June 22, 2009
Answered

Editable LinkElements

  • June 22, 2009
  • 2 replies
  • 857 views

Hi all,

I'm working on a project where the client wants to be able  to click the text and have a side screen display some info about the text and be able to edit at the same time.

So click the link and start typing in new text while the link's default action takes place, or my custom action.

Any ideas on how to get this to work with the framework?

This topic has been closed for replies.
Correct answer GordonSmith

A TextFlow dispatches a selectionChange event whenever the selection changes. In a handler for this event, you should be able to determine whether the selection includes one or more LinkElements and, if so, display info about, say, the first one.

Gordon Smith

Adobe Flex SDK Team

2 replies

June 23, 2009

Thanks Gordon, that's exactly what I needed to know.

GordonSmithCorrect answer
Participating Frequently
June 23, 2009

A TextFlow dispatches a selectionChange event whenever the selection changes. In a handler for this event, you should be able to determine whether the selection includes one or more LinkElements and, if so, display info about, say, the first one.

Gordon Smith

Adobe Flex SDK Team

Adobe Employee
June 23, 2009

That's one way to do it.  User styles to tag elements with your own custom properties might be of use here as well.

Also take a look at the CustomLinkEventHandler.as example program.  You can add your own event handlers to links like this:

var link:LinkElement = new LinkElement();

link.addEventListener(MouseEvent.CLICK,customClickHandler);

s =

new SpanElement();

link.addChild(s);

s.text =

"click me for a custom click event.";

// attach it to a textFlow and compose it into a container

private function customClickHandler(e:FlowElementMouseEvent):void

{

     // custom handling

}

Richard