Integrating Flex into Ajax applications
If you were looking forward to replacing all your Ajax content with Flex assets, your
task would be much simpler. However, this is an unlikely and often unreasonable
approach, because there are many reasons to preserve traditional Ajax functionality. ...
Listing 1 demonstrates a stripped-down example of how to use the
ExternalInterface class to register an ActionScript function so that JavaScript
code can call it. You do this by first defining an ActionScript function, then using the
addCallback() method to expose the function to JavaScript for execution. On the
HTML side, simply obtain a handle to the Flash container and call the function,
which was named using the first parameter to the addCallback() method.
Although this demonstration concentrated on exposing functions to the JavaScript
code, you can just as easily go the other way by using the call() method of the
ExternalInterface class.
The ExternalInterface class can be quite powerful, but there are significant
drawbacks to implementing it. To use ExternalInterface, you must be able to
write code to implement both the ActionScript and JavaScript environments. This not
only requires added skill but double the effort. In this situation, maintaining code as
well as two very robust skill sets can become a challenge.
To address the limitations of development against the Flash external API, Adobe has
released the FABridge. The FABridge, which ships with the Flex SDK, is a small
library used to expose Flash content to scripting in the browser and works in most
major browser platforms. With the FABridge, plumbing code that was required to
directly implement the Flash external API is now virtually eliminated. Further, the
skills required to implement the bridge aren't as robust. As a JavaScript developer,
you simply need to be able to understand what's available to you in the way of
ActionScript properties and methods. Let's get started with a few examples that
demonstrate the capabilities of the FABridge.
...
Source: download.boulder.ibm.com
Related PDF Files
- Using Adobe Flex In Jsr-286 Portlets
- Optimizing Your Flex Applications
- Creating Flex Applications With Intellij Idea
- Learning Flex Through Applications
- Developing Air Applications With Adobe Flex 3
- Using Adobe Flex Builder 3
- Integrating Adobe Flex And Ibm Websphere Portal
- Using Adobe Flex Builder 3
- Using Flex Builder 2
- Capacity Planning For Adobe's Macromedia Flex 1.5

Topic: