User Guide

Handling key and button events (Flash Professional only) 31
3. Create another static text field named Right, and position it in the lower-right corner of
the Stage, above the right soft key on the device.
4. Using the Text tool, create a dynamic text field, and position it in the middle of the Stage.
Your document’s Stage should look like the following example:
5. With the dynamic text field still selected, in the Property inspector, type status in the
Instance Name text box.
6. Open the Actions panel (Window > Actions) and, in the Timeline, select Frame 1 in
Layer 1.
7. In the Actions panel, type the following code:
fscommand2("SetSoftKeys", "Left", "Right");
fscommand2("FullScreen", true);
8.
Create and register an object to respond to keypress events (see “Using a key listener to
handle keypress events (Flash Professional only)” on page 28) by entering the following
code in the Actions panel:
var myListener:Object = new Object();
myListener.onKeyDown = function() {
if (Key.getCode() == ExtendedKey.SOFT1) {
// Handle left soft keypress event.
status.text = "You pressed the Left soft key.";
} else if (Key.getCode() == ExtendedKey.SOFT2) {
// Handle right soft keypress event.
status.text = "You pressed the Right soft key.";
}
};
Key.addListener(myListener);
Dynamic text field
Soft key labels