FAB – Flex / AJAX bridge

FAB – Flex/AJAX Bridge – is a library created by Ely Greenfield, who is a good friend and Flex Architect.

FAB lets you control Flex applications using JavaScript. Method calls just work, and getters and setters are converted to method calls (because browsers don’t support getters and setters yet).

You can even attach event listeners from JavaScript and pass function objects back and forth. For example, you can create an MXML file with a button in it and drive all of the logic from within your HTML/JavaScript.


<mx:Application xmlns:mx=”http://www.macromedia.com/2005/mxml”>
    <fab:FABridge xmlns:fab=”bridge.*” />
    <mx:Button id=”okButton” label=”OK” />


function init()
    var flexApp = FABridge.flash.root();
    flexApp.okButton().addEventListener(“click”, handleClick);

function handleClick(event)
    // handle the click event here.

You can read more about it on Ely’s blog, which I predict will be worth reading.


3 Responses to “FAB – Flex / AJAX bridge”

  1. Robert Penner

    Slight correction: it’s called “Flex Ajax Bridge”. Bridging ActionScript and Flex isn’t as noteworthy. =)

  2. Sho


    Good catch. Thanks, Robert.

  3. John Dowdell

    Is there any introspection, so that your JavaScript can know or confirm what the applet exposes? Or would the workflow be to document the available calls in both scripting environments, or to keep both open, so that you know proper names like “okButton” and such?

Leave a Reply