Skip to main content
drkstr_1
Inspiring
June 10, 2011
Answered

Creating a custom link type in a LinkElement

  • June 10, 2011
  • 1 reply
  • 1234 views

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 has been closed for replies.
Correct answer rdermer

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

1 reply

Adobe Employee
June 10, 2011

Try the "event:" syntax

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

Richard

drkstr_1
drkstr_1Author
Inspiring
June 10, 2011

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?

rdermerCorrect answer
Adobe Employee
June 10, 2011

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