So, Flex developers write MXML code to render user interfaces, and rely on external systems for any and all transactions, business logic, and back-end processing. How does Flex access these external systems? Flex provides tags that developers can use to:
It is worth noting that Flex itself does not really invoke web services or make HTTP calls or call remote Java objects, Flash does that. Flex generates a complete Flash application—a SWF file which runs in Macromedia Flash player—which makes all the back-end calls.
At this point, ColdFusion/Flash integration becomes obvious, Flex calls ColdFusion pages through HTTP requests, or invokes ColdFusion components (CFCs) as web services. You can use any ColdFusion code that you can invoke through HTTP or as a web service within Flex applications. To do this, you don't even have to have ColdFusion installed on the same server as Flex, although that configuration works too.
Figure 3. Application flow with ColdFusion as a Flex back end
In Figure 3, the flow works something like this:
This type of integration delivers true n-tier applications, and is best suited for actual applications rather than embedded controls, for example.
This integration is also ideal for applications with multiple presentation layers. For example, if you needed a straight HTML version of your application in addition to the more engaging Flex version, you could simply provide multiple presentation interfaces to your back-end code. You would put your application logic, without any UI at all, in ColdFusion components; CFML pages would invoke the CFCs and render the HTML version of the application; and Flex MXML pages would render the Flash version of the application—the bonus is that both use the same back-end code.