Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Mobile Flash Development for PocketPC


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)


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.