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