views:

344

answers:

2

I am writing a pure actionscript 3 application in Adobe Flex. I want my application to be exposed to scripting in a browser. It seems that there are two options: Adobe's Ajax Bridge (typically used with a Flex application that uses mxml?) and Adobe's External Interface class (flash.external.ExternalInterface). Is there any reason to use the Ajax Bridge over the ExternalInterface class?

Thank you.

+2  A: 

Good question. There is definitely reason to use one or the other.

If your application is an ActionScript application that needs to be able to communicate with JavaScript, the ExternalInterface object is probably the right tool. But, if your application is a JavaScript application that needs to control Flex components, the Ajax Bridge is the thing to use.

Some quick bullets from Adobe's documentation on FABridge:

  • You want to use a rich Flex component in an Ajax application but do not want to write a lot of Flex code. If you wrap the component in a FABridge-enabled stub application, you can script it entirely from JavaScript, including using JavaScript generated remotely by the server.
  • You have only one or two people on your team who know Flex. The FABridge library lets everyone on your team use the work produced by one or two Flex specialists.
  • You are building an integrated rich Internet application (RIA) with Flex and Ajax portions.Although you could build the integration yourself using ExternalInterface, you might find it faster to start with the FABridge.

You can get a broader perspective at http://livedocs.adobe.com/flex/3/html/help.html?content=ajaxbridge_1.html

Ross Henderson
A: 

rhtx,

Thank you for your response! This perfectly answers my question. I tried to vote up your answer, but my reputation is not high enough.

-Johann

No problem. I had the same issue for awhile. Thanks a lot for letting me know.
Ross Henderson