Search Flex Components Free

Custom Search

December 5, 2007

Understanding the Flex-Ajax Bridge Communication

The goal of the Flex-Ajax Bridge is to help automate the process of integrating Flex content into a broader HTML page. Flex is a great technology for building applications. With pretty much one line of code, suddenly everything you could do from ActionScript can now be done from JavaScript.
There's really sort of two models of developers who would want to consider using the Flex-Ajax Bridge. Clearly, the Bridge is for environments where you want to use both HTML and Flex content in the same web application. So if that's something you want to do, you can fall into one of two camps.
On the one side, you've got developers who are going to be doing a lot of HTML and Ajax authoring and doing a lot of Flex, Flash, and ActionScript authoring, and they just want to ease the process, remove a lot of the boilerplate code that they usually would have to write in order to integrate the two sides of their application.
On the other side, if you're a traditional HTML, Ajax developer who doesn't know a lot about Flex and Flash, the Bridge can be a great way to start dipping your feet in the water and just experimenting and trying to understand it.
There's a lot of great content out there and great components out there that have been written for Flex and Flash, and using the Bridge, you can very quickly and easily wrap up those components in a way that you don't have to necessarily have had a lot of experience with Flex and Flash in order to use them.
In order to get started, it's pretty straightforward. Essentially it requires two tags. There's one tag you put in your Flex application, called FABridge. You put it in there and, just by doing that, you expose your application to be scripted from JavaScript. So anything that you can do in ActionScript at that point you can now do from JavaScript.
In order to actually write script against the Bridge, there's one other tag. It's a JavaScript file that you just need to embed in your HTML page using a script tag. Once you've done that, you can start writing JavaScript against the contents of that Flex application.
The only limitations to using the Bridge right now are that it is pre-alpha software, so there's bound to be some bugs. And the Bridge is written to use the new Flash Player 8.5 beta, so it doesn't work on older versions of Flash Player.
I know the developers on the Flex team here at Adobe are really excited about the Bridge because of what it means for Adobe's approach to the web development community at large and to the open-source community. We'd all love to hear as much feedback as possible from the developers out there, as to what they're doing with it, what they think about it, and where it could be improved.

Related Flex Tutorials