×

Discussion Board

Results 1 to 2 of 2

Hybrid View

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    1

    Soft keys for multiple pages

    Hello,
    I am trying to create a Flash Lite app with multiple pages. The softkeys are not consistent in function across each page. For example, in the intro page the left menu maybe Opt1, Opt2, Opt3 and right OptExit. On the second page, the menu could be Opt4, Opt5, and right menu OptCancel. Each of these buttons lead to different pages.
    Is there a built-in function in Flash to detect current page? How do you propose I solve this issue?

    Thanks in advance.

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2006
    Location
    Mumbai, India
    Posts
    48

    Re: Soft keys for multiple pages

    Your question requires a solution on how use the Soft Keys to perform different functions on different pages/frames. There are 2 ways in which you could do this.

    The method I use most frequently is defining a Key Object and assigning a listener to it. Then when I move to a new page, I remove the listener from the old page and add the listener again to the new page. All this while, I keep using the same Key Object.

    PAGE 1
    Code:
    var keyObj:Object = new Object();
    keyObj.onKeyDown = function(){
    	if(Key.getCode() == ExtendedKey.SOFT1){
    		gotoAndPlay(2);
    		Key.removeListener(this);
    	}
    }
    
    Key.addListener(keyObj);
    PAGE 2
    Code:
    keyObj.onKeyDown = function(){
    	if(Key.getCode() == ExtendedKey.SOFT1){
    		gotoAndPlay(3);
    		Key.removeListener(this);
    	}
    }
    
    Key.addListener(keyObj);
    The second method is to use a variable which stores your page number. And then based on which page you are on, the KeyDown function, which is written only once, can be used.

    PAGE 1
    Code:
    var keyObj:Object = new Object();
    keyObj.onKeyDown = function(){
    	if(Key.getCode() == ExtendedKey.SOFT1){
                if(page == 1)
    		gotoAndPlay(2);
                if(page == 2)
    		gotoAndPlay(3);
    	}
    }
    
    Key.addListener(keyObj);
    Regarding the question of finding page numbers, there is a way to find out the the frame number at runtime using the _currentframe property.

    Hope this helps
    Mariam Dholkawala
    http://www.igamestudio.com

    Blog - http://www.mariamdholkawala.com/mobile
    MaD UG - http://www.indimadgroup.com

Similar Threads

  1. Nokia N81 soft keys
    By ronanocie in forum Mobile Java General
    Replies: 7
    Last Post: 2009-03-30, 12:39
  2. The Left and Right Soft Keys
    By nimbus_cloud in forum Symbian
    Replies: 19
    Last Post: 2009-02-10, 11:18
  3. Programmable Soft Keys in Mobile Browser using ECMAScript MP
    By TopazAl in forum Browsing and Mark-ups
    Replies: 2
    Last Post: 2008-01-09, 01:44
  4. GameCanvas and Soft keys
    By cookie_man in forum Mobile Java Tools & SDKs
    Replies: 5
    Last Post: 2007-07-16, 12:36
  5. My soft Keys of Nokia 6600 are not working for my application
    By ummarbhutta in forum Mobile Java General
    Replies: 6
    Last Post: 2006-03-27, 22:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •