User Guide

36 Tutorial: Creating a Flash Lite Application (Flash Professional Only)
3. Open the Actions panel and enter the following code:
Key.removeListener (myListener);
var myListener:Object = new Object ();
myListener.onKeyDown = function () {
var keyCode = Key.getCode ();
if (keyCode == ExtendedKey.SOFT1) {
// Handle left soft key event
gotoAndPlay ("home");
}
else if (keyCode == ExtendedKey.SOFT2) {
// Handle right soft key event
play ();
description_txt.text = "";
title_txt.text = "";
}
};
Key.addListener (myListener);
The left soft key sends the playhead to the main application screen, and
the right soft key advances the image animation to the next image in
the sequence.
For more information about using event listeners, see “Using a key
listener to handle keypress events (Flash Professional only)” in
Developing Flash Lite 2.x Applications.
4. Select Control > Test Movie to test the final application in the emulator.
Create the Video screen (Flash
Professional only)
In this section, you’ll add video to the application, as well as ActionScript
code that lets the user control playback (play, pause, replay) with the right
soft key.
In this tutorial, you’ll bundle the device video file in your SWF files library,
although you can also load an external video file from the devices file
system or a network address.
1. In Flash, open the file you completed in “Create the specials screen
(Flash Professional only)” on page 29.
2. Open the Library panel (Window > Library) if not already open.
3. Open the Library options menu located in the upper-right corner of the
Library panel and select New Video.
The Video Properties dialog box appears.