Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 01:54, 14 May 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:Flash Lite 2.0 Soft Keys Example

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

Article Metadata
Article
Created: marsdh (02 Apr 2007)
Last edited: hamishwillee (14 May 2013)


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.

status = 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. If the mobile device supports setting soft keys, the above call returns '0' and in case it does not support soft keys it returns '-1'.

Note:This command is supported only when Flash Lite is running in stand-alone mode. It is not supported when the player is running in the context of another application.(Eg embedded in browser)

The SetSoftKeys command takes two parameters, the first parameter specify the label for the left soft key and the second parameter specify the label for the right soft key. In case the application is not running in full-screen mode, these labels are displayed on the device. But for applications running in full-screen mode, these labels are not visible, so you must create your own labels and position them on the Stage where the soft keys are located.

Note: It is possible to set only one Soft-key without affecting the other soft keys.

  • In order to set Left soft key to "Select" and Right soft key to empty:
 status = fscommand2("SetSoftKeys", "Select", "")
  • In order to set Left soft key to "Select" and leave the Right soft key as is:
 status = fscommand2("SetSoftKeys", "Select")
  • In order to set Right soft key to "Exit" and leave the Left soft key as is:
 status = fscommand2("SetSoftKeys", undefined, "Exit")
 OR
 status = fscommand2("SetSoftKeys", null, "Exit")
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

This page was last modified on 14 May 2013, at 01:54.
86 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×