Accessibility

Table of Contents

NYC Traffic: Best Practices for Building Flash Lite Dynamic Content

Using Dynamic Content with Flash Lite 1.1

More and more Flash Lite applications are coming out that enable you to connect to the Internet for a variety of purposes. Although the possibilities for what the programs can do are limitless, the underlying purpose of most connected applications can be boiled down to three main activities: downloading real-time information, uploading user data (forms), and modular downloads.

Downloading real-time information is one of the most exciting parts of working with Flash Lite 1.1. The ability to load information that simply could not have been pre-programmed into a SWF movie ahead of time vastly increases the flexibility and power of any application. I've now used Flash Lite applications to check traffic conditions, see the weather report, get the latest news, and even check out the TV listings.

To provide up-to-date information that is truly useful, the information has to be relevant and tailored to the individual user. Flash Lite 1.1 also enables you to upload content to the server as part of its request for dynamic data. Some interesting applications that I have seen include Flash files that enable me to check on the status of a flight, search the web, or even communicate with friends through a chat client.

Even while thinking of the many exciting possibilities that are available for rich content and experiences, you must remember that mobile devices come with several limitations over a traditional desktop computer. Most notably, mobile phones have vastly less storage and limited bandwidth. Flash Lite 1.1 can help you minimize the impact of both issues by using some of the techniques from traditional Flash environments.

Sample Connected Applications

Similar to Flash, Flash Lite enjoys a strong developer community full of people eager to share their applications and their experiences. A great resource for finding Flash Lite content is the Macromedia Flash Lite Exchange. Take a look at some of the following examples of connected applications that load a variety of data.

Figure 1 shows the iShop Pro-US application by Guiseppe Tabi and VFB Soccer by Jochen Geiger. The iShop Pro-US example is an easy-to-use comparison shopping application that pulls prices and reviews from amazon.com. The VfB Soccer application displays all of the latest information and upcoming events for Jochen's favorite soccer team, VfB Stuttgart.

iShop Pro-US (left) and VfB Soccer (right)

Figure 1: iShop Pro-US (left) and VfB Soccer (right)

Figure 2 shows my NYC Traffic application and Fasils Iqbal's Chat MX. NYC Traffic displays real-time traffic images from intersections all over Manhattan. Chat MX is a Flash Lite group chat client where you can pick a character and send messages.

 NYC Traffic (left) and Chat MX (right)

Figure 2: NYC Traffic (left) and Chat MX (right)

Usable Content Formats

Now that you know the possibilities, you need to know which types of content can be loaded into Flash Lite. You can load text-based variables and SWF files into an existing Flash application. More specifically, you can load a URL-encoded text file that defines variables as strings within a specific timeline or you can load another SWF file provided that it is exported for either Flash Lite or Flash 4. The SWF movie then acts like a movie clip within your application. Here is what the code looks like for loading variables and for loading SWF files (in the next section I will show you some more detailed examples):

//load variables onto the root timeline
loadVariables(http://justin.everett-church.com/mobile/variables.txt, "/")
//load a swf into Level 1
loadMovieNum("http://justin.everett-church.com/mobile/sample.swf", 1)

While this may not be as robust as what you can do with Flash Player on a desktop computer in terms of flexibility in data formats, with a bit of effort you can do just about anything through loading text or a SWF file.

On the server side it is possible to write your own scripts to convert XML or other text-based pieces of data to URL encoding. In my own applications I have used one of the many server-side SWF generation scripts to transcode JPEG image files into Flash 4 SWF files for download to my phone. There are even applications that can transcode audio and video into Flash files.

If this description of the formats is too high-level, don't worry; in the next section I'll provide more details about each of the data formats as well as the idiosyncrasies of connecting to the Internet from your Flash Lite–enabled mobile phone.