Testing the Application
You can use the built-in Flash Lite phone simulators to test the application at any time during development. I recommend testing applications regularly. Just select Test Movie from the Control menu (or Ctrl-Enter).
When the device player is launched, this message is displayed on the Output console:
FTPS030: FSCommand2 FullScreen command not supported in the emulator, please test it on the device
This message appears because the authoring tool automatically inserts the following command in the first frame of the application. This command is only executed on real devices; emulators don't support it:
fscommand2("FullScreen", true);
At this point, you can edit the phone list you plan to test your application on by selecting Device Settings in the Test Device pull-down menu. This brings up the Device Settings dialog, which you can use to select phones from the list on the left side (Available Devices) and add them in the emulated devices list (Test Devices) on the right.
Also at this point, you can download and install the new device profiles from Adobe by following the link "Check for new devices" in the bottom-left corner of the dialog screen.
Creating Application Structures
Figure 2 illustrates the structure for the baseball application. After opening the application, users land on a selection page, where they can edit the year for which the statistics are retrieved. They then initiate the network data retrieval by selecting either the Top 5 Homeruns or Top 5 Salaries buttons. There is also an Exit button.
After the data has been retrieved, users are forwarded to a results page, where they can see the resulting players. By pressing the right softkey, users are returned to the selection page. From that page they make a new selection or exit.
The selection page is the first frame of the application. Because it is helpful to keep the Flash applications organized with layers, you should create an additional layer named "Buttons" between the ActionScript and Content layers. If you want a background that's different for different screens, you should create a Background layer in the bottom of the layer stack.
Create three static text items on the Content layer and enter the text (Top 5 Homeruns,...) previously mentioned. Also, create an input text field for getting the year and a static text field as a label for it. In the property inspector, enter statYear in the Var field of the input text field you createdthis ties the statVar variable to the contents of the text field.
The next step is to create the selection rectangles for the menu. First, create an invisible button with the command Insert->New Symbol. That button is placed in the Library and the contents (currently nothing) of that object are shown on the Stage. Define a keyframe in the hit state of the button, and define the clickable area of the button by drawing a rectangle in that state. Change the active layer to Buttons and copy this invisible button on top of the three text items. The screen on the stage should look something like Figure 2.
To make the application functional, add Listing Three (a) on the ActionScript layer of frame 1. The three buttonshomeruns, salaries, and exiting the applicationshould contain Listings Three (b), (c), and (d), respectively. This lets users move the focus with the joystick from one button to another and select the current button with the selection key.
<b>(a)</b> // this ActionScript sets your // content to be full screen fscommand2("FullScreen", true); statYear = 2006; stop(); <b>(b)</b> on (release) { target = "homeruns"; gotoAndPlay("frLoad"); } <b>(c)</b> on (release) { target = "salaries"; gotoAndPlay("frLoad"); } <b>(d)</b> on (release) { fscommand2("Quit"); }
In the main timeline, create keyframes on frames 5, 10, and 15. In the property inspector, name the frames frLoad, homeruns, and salaries, respectively. Go to frame frLoad, place a static text field on the Content layer, and enter "Loading data, please wait..." in the text field. This remains until the data is fully loaded from the server to show populated statistics data pages. To generate a control structure for the waiting screen, create additional keyframes in frames 6 and 7, and name frame 6 wait1.
Next, go to the frame homeruns, and generate the result display on the Content layer. Use a static text field for the title; if you want to show the selected year, create a dynamic text field next to the title. In the property inspector, enter statYear in the Var field. Generate a 5×2 grid using dynamic text fields (you could use borders in these fields), and tie variables to be downloaded from the server to each of these fields. The first row points to variables name1 and value1, and so on. Repeat the steps for frame salaries.