14
Oct

Capturing clicks on hyperlinks in htmlText for Label, Text, TextArea

Comments Off on Capturing clicks on hyperlinks in htmlText for Label, Text, TextArea

Lately I had to create an interesting workflow for a Flex Application. I had to change the default behavior of Label, Text and TextArea components so that when users click on a hyperlink, instead of opening that url into the same window, open it into a popup window.

The javascript code to open a pop-up was very simple.The most challenging part was to search if Flex SDK provides something helpful. After a little research I found out that the Label, Text and TextArea  controls can dispatch a link event when the user selects a hyperlink in the htmlText property. Sounds simple, but in order to dispatch the event, the htmlText property needs to prefix the hyperlink destination with event:, as the following example shows:

<a href='event:http://www.adobe.com'/>

Now when the htmlText property is dynamic, it needs to be parsed and prefix each url with ‘event:’. Thanks to the support for Regular Expressions in Flex, this task is really simple. The code bellow does the replacement:

htmlText.replace( /href=(\'|\")/ , "href=$1event:" );

If you want to see a complete sample on how to capture the link event, you can go to : Adobe Flex Help – Text Controls

06
Oct

Cairngorm 3 Beta has been released

Comments Off on Cairngorm 3 Beta has been released

Most important about Cairngorm 3 is that it doesn’t represent anymore an MVC framework.
Cairngorm 3 is moving towards best practices and recommendations, gathered by the Adobe Technical Services Organization and partners over the last five years. It also contains a set of tools and libraries that can be applied across frameworks.

Basically, Adobe took some time to analyze how Flex is used, how it behaves in various applications, and Cairngorm 3 aims to come up with solutions for the most common architectural matters.

To read more go to Cairngorm 3 page.