Illudium Flex Remoting Templates

I'm probably the laziest programmer on the face of the planet. As such, I am habitually looking for shortcuts and the fastest ways to accomplish things within the scope of all that I consider "acceptable" programming practices (a shockingly lax set of self-imposed development guidelines). For this reason, I spent the better part of the day customizing some Illudium PU-36 Code Generator templates to produce CRUD components for Flex development. Why would I do this, you ask? Because the ColdFusion Application wizards are not supported on the Mac platform and I spend at least 30% of my coding time writing the CFC interfaces needed by my Flex applications. The templates essentially create the same type of CFC files that the Windows version of Flex Builder generates. The resulting components are nearly identical to the default components that Illudium supports "out of the box" with a couple of exceptions. They have been slightly modified to support Flex RemoteObject calls. The code also instantiates objects in a slightly different way so that Flex can run everything through the Service CFC that Illudium creates. If you've used the CF application wizards on the Windows version of Flex Builder, the Illudium generated version is very similar (but better, I think) to the components created by it.

The enclosed zip file contains a folder that you should copy to your xsl\projects folder at the root of your Illudium directory. A new Template type entitled "FlexRemoting" should appear in the drop down box when you run Illudium. Point Illudium to your database table, choose the FlexRemoting template type, enter your dot notation to the CFCs (as they will be referred to in the RemoteObject function in Flex) and click the "Generate" button. Four files will be created (Bean, DAO, Gateway, and Service). Once you save these to the appropriate folder in your Flex project directory, open the Service CFC file and go to the bottom of the file. Find the function named "initCRUD" and replace the DSN place holder with the actual DSN you'll want to call with your components. Then, simply point your Flex RemoteObject (get, create, save, delete) functions to the appropriate function in the Service CFC.

Illudium appears to be a great tool and it has the potential to save substantial time when coding Flex applications if you, like me, don't have access to the full suite of ColdFusion extensions within Flex Builder. The FlexRemoting templates are my first attempt at customizing Illudium since I've only been working with it for about a day. If you have any recommendations as to how the templates could be improved, I'd love to hear them.

Quick and Dirty Flex App Reset

I'm fairly new to Flex development so, naturally, I search for the most complicated way to complete simple tasks. The intranet based application on which I'm currently working has a relatively simple security model and the application includes a system logout button. For the longest time I've been searching for a method to reset the application when a user clicks the logout button because, invariably, the user will leave that window open and attempt to use it to log in at some point in the future. In my experience, logging in to an application in which you've simply changed the view state (back to the "login" view state, for example) takes the user directly back to where they were when they clicked the logout button. Any changes to the user security profile or the data with which they're working will not be reflected in this scenario. Also, if you happened to have deployed a recompiled version of the application between the time the user logs out and the next time they log in, they'll be using the old version of your app. The simple solution to this problem was so simple, I was unable to find it. It was hiding in plain site. All that needs to be done when the user clicks the logout button is to use the navigateToURL function with a window parameter of "_self". The whole application is reloaded and everything starts fresh (assuming the URL didn't change sometime between logoff and logon).

As for the "version" problem I described above, this could actually be checked by storing the version number of the Flex app in the application code itself and then comparing that value to a current_version value stored in the application's database somewhere. If the two values disagree, you could present an error message telling the user they needed to "upgrade" prior to running the application. Although less important in the web paradigm, this might be handy when running Flex apps on user desktops using AIR.

If this makes no sense or is so painfully obvious that you think I should give up programming forever, please drop me a note and/or post a better way to do what I've described.

Flex Component Site

I stumbled across a really great site that has a number of very useful Flex components. Among them are a simple component to filter data in a DataGrid, several components to give your user interface a reflective quality, an HTML image map emulator, and much more. Even if you don't need the components, the source code serves as a great learning tool. Check out Flexbox here.

BlogCFC was created by Raymond Camden. This blog is running version 5.9. Contact Blog Owner