
Macromedia Flash has been a capable client computing platform for quite some time, and ever since Macromedia Flash MX, integration with ColdFusion has been clean and simple. But recently released Macromedia Flash MX Professional 2004 Wizards make the process of building ColdFusion-powered Flash applications easier than ever, as this article will demonstrate.
Note: This article assumes a good working knowledge of ColdFusion, use of ColdFusion MX, and basic familiarity with ColdFusion Components.
For many of us, the word "Flash" still conjures up images of slow downloads, often extraneous animation, overly intrusive pop-up ads, and "Skip Intro." That's a shame. While Flash has proven itself invaluable in the graphics and design department, and indeed that is where its origins lie, Flash player can do so much more. In fact, since the release of Flash MX (and now with Flash MX Professional 2004), developers from a variety of backgrounds are discovering that Flash has legitimate and unparalleled value in application development in general.
The Flash player runs Flash files (SWF files), which you create using the Flash IDE (lots of uses of the word Flash, and thus, frequent confusion as to what exactly we're referring to at any given time). Players are available for all sorts of operating systems and devices and platforms, and the same SWF files run in exactly the same way on each. This makes Flash a very compelling alternative to HTML and DHTML, which is anything but portable. In addition, as the Flash player is a thin-but-not-as-thin-as-the-browser client, the player is capable of so much more than plain old HTML (even HTML plus client-side scripting).
But Flash runs on the client, not on the server. Flash therefore cannot access databases on the server, and cannot generate e-mail messages or authenticate user logins. All of these require communication between Flash on the client and a back-end server. And Macromedia has built this capability—being able to communicate to back-end servers—right into Flash player.
As such, you can use Flash as a client in client-server style development, both as an alternative to specific elements in an HTML page, and as a replacement for complete HTML application front ends.
Note: To follow along you'll need to be running Flash MX Professional 2004 with the latest updates and wizards installed. See more in the Getting Set Up section.
The best way to understand Flash applications and how they relate to ColdFusion is to build a sample application. This article does not cover every Flash feature and option and only uses a few of the included components; refer to the included documentation for complete component coverage and extensive examples. Having said that, I'll guide you through building a complete application. The application will be a data-entry front end for a user database and will feature:
…all without browser screen refreshes!
Ready? Great, we're about to begin, but first some setup details.
To complete this tutorial you will need to install the following software and files:
A couple of important notes on your Flash installation:
You can download the Data Connection Wizard and DataGrid Column Editor extensions from Macromedia Exchange. Here's how you get them:
Before installing the extensions, download and install the most recent Extension Manager.
Download the following extensions:
The sample files in ZIP contain the complete code for this application. Instead of using the solution files for this application, I suggest you build the code along with me. I'll tell you when you need to refer to the solution files near the end of this tutorial.
To ensure that you have installed the extensions, open any Flash document in Flash MX Professional 2004. Go to the Commands menu. If the they are installed, you'll see a menu option called Data Connection Wizard. For this tutorial, you use the DataGrid Column editor through the Data Connection Wizard and therefore it does not appear in the Commands menu.
If you have all the software installed, continue with these steps: