Flex 2 is not “all or nothing”

Share this article

Ever since Macromedia announced Flex 2 and made available pre-release versions, I’ve been gritting my teeth as more and more cool news has surfaced about what Flex 2 will be capable of.

Because Macromedia Adobe will not be offering free licenses for non-commercial users of Flex 2 as it did for Flex 1, I’ve avoided recommending the technology to people despite the steady stream of exciting news that has come with the successive pre-release versions (now Beta 2).

The latest exciting tidbit — which has forced me to grudingly give the platform another look — is that Adobe has developed the Flex-AJAX bridge. The name is slightly misleading, as it’s really more of a Flex-JavaScript bridge, but it does help Adobe fend off some of the perception of AJAX as a Flex killer.

This bridge is an extension library for Flex that, when loaded, allows JavaScript code in a page to communicate with a Flex application, getting/setting property values, manipulating user interface elements, and registering JavaScript event listeners for elements inside the Flex application that would otherwise only be accessible to the ActionScript code within the application. Likewise, the bridge allows the Flex application to reach out into the containing HTML document, get/set form field values, manipulate CSS properties, and register event listeners that will allow the Flex application to respond to JavaScript events.

Where previously Flex was seen as an all-or-nothing platform for web applications, where your Flex application just filled the browser window with a Flash movie containing the user interface, the Flex-AJAX bridge lets you build hybrid applications, with smaller components that can benefit from Flex’s flexibility while the rest of the user experience can continue to be presented using HTML and CSS, with all the added compatibility and accessibility that brings.

To try out the Flex-AJAX bridge, you’ll need the most recent beta release of Flash Player 8.5. You can then check out the simple hybrid store example that Flex developer Christophe Coenraets described in a recent blog entry. The application makes use of the slider component from the Yahoo! User Interface Library to provide some JavaScript-powered controls that allow you to filter a set of results displayed in the adjacent Flex application.

A more detailed example may be found on the Adobe Labs site, which shows off the remarkably simple JavaScript code required to communicate with Flex using the bridge.

I’m still not jumping on the Flex bandwagon just yet, but if the right project came along and the investment were justified… well, you never know.

Kevin YankKevin Yank
View Author

Kevin Yank is an accomplished web developer, speaker, trainer and author of Build Your Own Database Driven Website Using PHP & MySQL and Co-Author of Simply JavaScript and Everything You Know About CSS is Wrong! Kevin loves to share his wealth of knowledge and it didn't stop at books, he's also the course instructor to 3 online courses in web development. Currently Kevin is the Director of Front End Engineering at Culture Amp.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form