Skip to main content
drkstr_1
Inspiring
Jun 10, 2011 5:07 PM UTC
Answered

Creating a custom link type in a LinkElement

Hello,

We need to be able to have a LinkElement that shows a pop up (TitleWindow) when clicked. Before Flex 4.5 came out, we were using our own modified TLF build, which added support for this (among other things) by doing the following:

<our_name_space:a href="popup:some_popup_class">Foo</our_name_space:a>

However, having our own TLF was causing more headaches than it was worth (mainly trying to cast things as ISWFContext when embeding fonts).

Since the TLF version included in Flex 4.5 has most of what we need, we scraped our internalized version and just went with the stock build. However, I still need to be able to support the functionality described above.

What would be the best way to implement this kind of functionality? Should we just create a new element type that provides the desired functionality? Can this be done without having to internalize the entire framework?

Any advice or links to relevent reading material would be greatly appriciated.

Thanks for your time!

This topic is closed to new replies. Start a new post to keep the conversation going.
rdermerCorrect answer
Inspiring
Jun 10, 2011 5:44 PM UTC

By using user styles.

<a href="event:popup" popupClass="somePopupClass">FOO</a>

Add a listener for the popup event to TextFlow.  The event will tell you which linkElement was clicked on and you can use the getUserStyle API to access the value of popupClass.

Richard

5 replies

Inspiring
Jun 10, 2011 5:16 PM UTC

Try the "event:" syntax

http://blogs.adobe.com/tlf/2010/12/tlf-flowelement-linkelement-events-and-eventmirrors.html

Richard

Translate
drkstr_1
drkstr_1Author
Inspiring
Jun 10, 2011 5:34 PM UTC

Yes but how would I attribute the pop up class to the event? That would only work if I knew what goes after the event:, which I don't. The popup content is defined at runtime, hence the class.

Am I mistaken in how the event: syntax works?

Translate
rdermerCorrect answer
Inspiring
Jun 10, 2011 5:44 PM UTC

By using user styles.

<a href="event:popup" popupClass="somePopupClass">FOO</a>

Add a listener for the popup event to TextFlow.  The event will tell you which linkElement was clicked on and you can use the getUserStyle API to access the value of popupClass.

Richard

Translate