Helloo. So I want to make some of the focus of my new game be around beating levels really fast, so I thought it would make sense to save each level’s fastest time beaten as a shared object for consistency. Unfortunately I am having problems implementing this plan, and I have no idea why at this point.
Here are my shared object functions (inside my Level class):
public function GetBestTime():Number
{
sharedObject = SharedObject.getLocal(levelName);
if (sharedObject.data.bestTime > 0)
bestTime = sharedObject.data.bestTime;
sharedObject.flush();
return bestTime;
}
public function SetBestTime(n:Number):void
{
sharedObject = SharedObject.getLocal(levelName);
sharedObject.data.bestTime = n;
sharedObject.flush();
}
For context, I use the GetBestTime() function at the very top of my class to determine its bestTime variable, and I use the SetBestTime() function when the player finishes the level.