Skip to main content
Jun 22, 2009 11:02 PM UTC
Answered

Editable LinkElements

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 is closed to new replies. Start a new post to keep the conversation going.
GordonSmithCorrect answer
Participating Frequently
Jun 23, 2009 12:37 AM UTC

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

3 replies

Jun 23, 2009 4:00 PM UTC

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

Translate
GordonSmithCorrect answer
Participating Frequently
Jun 23, 2009 12:37 AM UTC

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

Translate
Inspiring
Jun 23, 2009 4:28 AM UTC

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

Translate