You could have a function in each scene that stored the frame and scene that you had come from. In Scene A for example you might have a button that when you click on it you would go to Scene 2. The script would be like this (the button is named 'testbtn' for my example):
import flash.events.MouseEvent;
testbtn.addEventListener(MouseEvent.CLICK, gootherscene);
stop();
function gootherscene(e: MouseEvent) {
testbtn.removeEventListener(MouseEvent.CLICK, gootherscene);
var f: int = currentFrame;
var s: String = "Scene A";
gotoAndStop(1, "Scene 2");
setreturn(f, s)
}
That function would take you over to Scene 2, and it would call a function 'setreturn', to make a note of where you came from.
In Scene 2 (and all other scenes) you would have this script:
import flash.events.MouseEvent;
var returnscene:String;
var returnframe:int;
returnbtn.addEventListener(MouseEvent.CLICK,doreturn);
function setreturn(framenumber:int,scenename:String){
returnframe = framenumber;
returnscene = scenename;
}
function doreturn(e:MouseEvent){
returnbtn.removeEventListener(MouseEvent.CLICK,doreturn);
gotoAndStop(returnframe,returnscene);
}
When the return button (named 'returnbtn' in my example) is clicked, it would go back to the frame and scene that you had come from.