Getting Started
Of course, to get started, you're going to need a PocketPC device and a Flash Authoring Environment. Remember, you can use either Flash MX 2004 or Flash MX Professional 2004. The only difference between the two is that the Professional version is better suited for Visual Basic and Swing programmers, who are more accustomed to forms and panels rather than timelines and keyframes. For the purposes of this article, I used Flash MX and an iPAQ 4155 to develop and test the examples.
On the other hand, if you don't want to purchase a device with Windows Mobile 2003 (that is, PocketPC 2003), you can use the Flash Standalone Player to make .exe files in PocketPC format and download the free Windows Mobile 2003 emulator from Microsoft. If you choose to go this route, here's a list of files that you'll need to install to run the Windows Mobile 2003 emulator:
- eMbedded Visual C++ 4.0 (use the key TRT7H-KD36T-FRH8D-6QH8P-VFJHQ)
- eMbedded Visual C++ 4.0 SP3
- PocketPC 2003 SDK
Of course, it seems a little silly that you have to install the entire eMbedded Visual C++ SDK to use the emulator, but, hey, I don't work for Microsoft so don't shoot the messenger!
The Temperature Converter Application
To demonstrate some of the capabilities of Flash on the PocketPC, let's look at a simple Temperature Converter application that converts temperature from Fahrenheit to Celsius. The left side of Figure 3 shows ex1.fla within Flash MX, which is a simple 240 x 260 pixel movie with a few text boxes and a button. The right side of Figure 3 shows the compiled version of the movie, ex1.swf.
Figure 3: The Temperature Converter without a title or a version number. (Full Size)
Note: To preview your movie, just press Ctrl+Enter.
Currently, the movie doesn't have a title or a version number, because ideally, those items should be kept in a property file.
Working with Property Files in Flash
In Flash, to read data from a property file, you must write a little ActionScript code. Don't worry, Macromedia makes this task extremely simple. In my applications, the dynamic text boxes for title and version number of the application are appropriately named, "title" and "version." Of course, they could be named almost anything, but I chose those names to keep things simple. Below are the contents of the ex1.txt property file used for the Temperature Converter application.
title=Temperature Converter&version=1.0
As you might have expected, the file contains two name-value pairs separated by an ampersand. So, why would Macromedia make entries in a Flash property files separated by ampersands? Keep in mind, Flash was created as an interactive application for the Web, so it should be no surprise that the contents of Flash property file look like a URL string. Following is the ActionScript code that's needed to read and parse ex1.txt.
loadVariablesNum("ex1.txt", 0);
And that's it. You can't get any simpler than that. You also have the option to load data from a URL of a plain text file, as shown here:
loadVariablesNum("http://www.cmp.com/ex1.txt", 0);
Figure 4 shows the movie with the title and version number loaded from the properties file.
Figure 4: The Temperature Converter with the properties file loaded (Full Size)