I would to have my mobile application remember its place when the user leaves the application (through a phone call interruption, exit, menu button etc.). When the user returns I would like the app to ask the user if it would like they would like to resume in the same place or if they would like to start over.

Currently I have the following code. When the user comes back to the application they go to a specific place:


import flash.desktop.NativeApplication;

stage.addEventListener(Event.DEACTIVATE, onLeave);
stage.addEventListener(Event.ACTIVATE, onComeBack);

function onLeave(event:Event):void
{
SoundMixer.stopAll();
stop();
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;
}

function onComeBack(event:Event):void
{
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
gotoAndStop("1","MainScene");

}


_______________________________________



How do I do the following?



1) Have the mobile application remember its place when the user leaves the application.



2) When the user returns have the app to ask if they would like to resume in the same place or if they would like to start over (gotoAndStop("1","MainScene")


*Any links to references would be appreciated also.