the_variable_to_save = _root._currentframe;
I also wouldn't use _currentframe as a variable name as it's likely to clash with the read-only Movieclip property by the same name. For example, gotoAndStop(_currentframe); is probably going to try to move the playhead to the current frame (i.e the frame it's currently on), rather than the one stored in your variable. If you stick to meaningful variable names such as "level" or "current_level", you won't go far wrong.
However using this _currentframe approach might not be suitable as it can take you to a frame which is midway through a level, which you might not want. For example, if "section2" starts on frame 100, and "section3" starts on frame 120, what happens if the player tries to save the game on frame 115?
So the third approach might be a better one:
ActionScript Code:
// In frame 1 create the shared object
var so:SharedObject = SharedObject.getLocal("user_location");
// read the attributes saved in the Shared Object
saved_level = so.data.savedLevel;
// Check to make sure it contains data. If not, e.g. if this is the first
// time the game is run, start on level 1
if (saved_level == undefined) {
saved_level = 1;
}
//
// rest of your code, if any, goes here
//
// Now go to the saved level
gotoAndStop("section" + saved_level);
// generic function to save every level
function saveSO(level:Number):Void {
// save the current_level that was passed into the function
so.data.savedLevel = level;
// and write the Shared Object to the disk
so.data.flush;
}
//
// then, at the start of each level, add the following code, e.g.
// on frame "section1"
//
var current_level:Number = 1;
// pass the current level to the saveSO function
saveSO(current_level);
// rest of your code, if any, goes here
Continue in this fashion. "section2" would have the current_level = 2; and then you'd call the saveSO function..."section3" would be current_level = 3...and so on. And all you're saving in the Shared Object is a single number representing the current game level, instead of a list of every completed level so far!
As an added bonus, this code would automatically save each level without the need for a save button. But you can still place the saveSO(current_level) function call within a button handler if that's what you want. All you have to do is tell it what the current_level is.
One final suggestion with Shared Objects...although you've raised your local settings, bear in mind that:
a) a lot of people do panic when they see that dialog window open up, thinking that Flash is doing something mysterious to their PC, and
b) those that don't probably won't allow Flash to have more space.
So keeping your Shared Objects below the default level (or smaller) is best.
Hope that helps.