MACROMEDIA FLASH 8-DEVELOPING FLASH LITE 2.X Develop Manual page 29

Developing flash lite 2.x applications
Hide thumbs Also See for FLASH 8-DEVELOPING FLASH LITE 2.X:
Table of Contents

Advertisement

6.
Open the Actions panel (Window > Actions), and enter the following code:
var myListener:Object = new Object();
myListener.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
circle._x -= 10;
} else if (Key.getCode() == Key.RIGHT) {
circle._x += 10;
} else if (Key.getCode() == Key.UP) {
circle._y -= 10;
} else if (Key.getCode() == Key.DOWN) {
circle._y += 10;
}
};
Key.addListener(myListener);
7.
Test the application by selecting Control > Test Movie.
Press the four navigation keys on the emulator's keypad (or the corresponding arrow keys
on your keyboard) to make the circle move around the Stage.
Using the soft keys (Flash Professional only)
To use the soft keys in your Flash Lite application, you must first call the
command. Subsequently, Flash Lite generates an
presses the left soft key and an
key. You write ActionScript event handler code that responds to these events and takes the
desired action.
The
command takes two parameters that specify the labels for the Left and
SetSoftKeys
right soft keys, respectively, that appear when your application is not running in full-screen
mode. For applications running in full-screen mode, the labels that you specify are not visible,
so you must create your own labels and position them on the Stage where the soft keys are
located.
For example, consider the following
fscommand2("SetSoftKeys", "Options", "Exit");
ExtendedKey.SOFT1
ExtendedKey.SOFT2
command call:
SetSoftKeys
Handling key and button events (Flash Professional only)
event when the user
event when the user presses the right soft
SetSoftKeys
29

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-DEVELOPING FLASH LITE 2.X and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash 8

Table of Contents