×
Namespaces

Variants
Actions
Revision as of 11:47, 2 April 2007 by marsdh (Talk | contribs)

Archived:Flash Lite 2.0 Soft Keys Example

From Nokia Developer Wiki
Jump to: navigation, search


Soft Keys on a mobile refer to the 2 keys which are usually found immediately below the mobile screen. They are called "soft" because their use is decided by the software that you run on your device.

The use of the Soft Keys in Flash Lite is no different from the soft keys in any other application. When you run a Flash Lite application in the Flash Lite Player, the player displays its own pull up menu with options like Volume, Pause, Rewind, Quality, Full Screen, Zoom In, Send etc on pressing the Left Soft Key. Pressing the Right Soft Key will exit the application.

Soft Keys can be controlled from within a Flash Lite application. You can prevent its default behaviour by remapping it to perform the functions you want it to, and this can be done with the code that is mentioned below.

fscommand2("SetSoftKeys", "left", "right");

You begin by remapping the Soft Keys by using the SetSoftKeys fscommand2 command. It is essential that you place this code on the main timeline, at a frame from where you want to start managing the soft keys on your own.

var keyList:Object = new Object();
keyList.onKeyDown = function(){
var keyCode = Key.getCode();
if(keyCode == ExtendedKey.SOFT1){
trace("Left Soft Key Pressed");
}else if(keyCode == ExtendedKey.SOFT2){
trace("Right Soft Key Pressed");
}
}
Key.addListener(keyList);

Flash Lite now has an ExtendedKey Class, which allows the use of upto 12 Soft Keys as supported by the device. We use the ExtendedKey Class along with the Key Class to access the Soft Keys.

fscommand2("ResetSoftKeys");

Finally while exiting the application, its always advisable to release the remapped soft keys by using the ResetSoftKeys fscommand2 command.

LINKS :
Learn more about Soft Keys through the Adobe Live Docs link
Keys supported in Flash Lite link

87 page views in the last 30 days.
×