I finally got around to blogging a simple Cairngorm application that I had written a few months back just after completing my Flex Trainers’ training.
The application is a simple contact manager that allows for contacts to be listed, added, edited and searched. The backend uses ColdFusion to store information in memory. For the sake of simplicity of this application, I have deliberately not used a database and used session variables instead.
I wrote this app to get my head around key Cairngorm concepts. I found this really helped to understand the basics of the framework. This application uses Cairngorm 2.0.
If you are new to Cairngorm, have a look at cairngormdocs.org, especially the Cairngorm diagram.
To use this application you need Flex Builder 2 and ColdFusionMX 7.0.2.
Installation instructions:
- Unzip CFCairngormContacts.zip in the webroot of your ColdFusion server. This will create two folders:
- CFCairngormContacts (containing the Flex code for the application and Cairngorm 2.0 SWC)
- com (which contains ColdFusion code)
- Check ColdFusion backend by browsing to: http://yourserver/com/nagpals/examples/contact/index.cfm.If you see a couple of dumps and a message saying “Successfully retrieved contact list”, ColdFusion is setup correctly.If not, then you need to make sure this works first.
- Set up the app in Flex Builder.
- Create a new Flex project in Flex Builder.
- Select “ColdFusion Flash Remoting Service”
- Specify Root Folder as the the filesystem path to the ColdFusion server webroot.
In my case: D:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\ - Specify Root URL as the URL to the ColdFusion server.
In my case: http://localhost:8300/ - Specify Project Name: CFCairngormContacts
- For Project Contents, uncheck the “Use default location” and select the location as the filesystem path to the ColdFusion server webroot.
In my case: D:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\ - Add a SWC to the project by going to Project > Properties > Flex Build Path > Library Path (tab) > Add SWC.
Select the Cairngorm.swc in /CFCairngormContacts/com/adobe/cairngorm directory. - Also make sure that the Flex Compiler arguments are setup to look at the correct services-config.xml. Project > Properties > Flex Compiler. The arguments are specified in the “Additional compiler arguments” field. In my case they read: -services “D:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\flex\services-config.xml” -locale en_US
- Run the application and you should see the Contact Manager load up in a browser.
TODO:
- Add a running version of the application (my current host is not running CF 7.0.2)
- Migrate it to Cairngorm 2.1
- Add more information on how the application is structured
Do let me know if you get any issues in getting the app to run.
PS: The UI of the application is based on a similar application created by Robin Hilliard @ Rocketboots using Flex 1.5.