Following my post Flex and Oracle, I wanted to investigate how difficult it would be to exchange data between flex and ApEx. After some trial and error I’m pleased to say that it isn’t that hard to exchange data between both technologies.
I started by looking for a way to get a simple string from a flex application to an ApEx application. I came across the ActionScript API “ExternalInterface“. The Adobe documentation for the api:
The ExternalInterface class is the External API, an application programming interface that enables straightforward communication between ActionScript and the Flash Player container or a desktop application with Flash Player embedded.
ExternalInterface has a method “call” where you can specify the name of the external function you want to call, the second parameters are the parameters you want to pass to that function.
In your html page make a function called “setDept” with the necessary parameters and let the fill the Apex Items. Make a clickhandler in your flex application and call your function, you will see that it works perfect.
Your Actionscript could look something like this:
<!–You can find a working example here.–>