OK, I thought I was understanding how to use SharedObjects, but I guess I’m not. When trying to clean up/initialize variables in the object, I get this error:
TypeError: Error #1010: A term is undefined and has no properties.
at MethodInfo-89()
at Main/ClearScores()
at Main$iinit()
TypeError: Error #1010: A term is undefined and has no properties.
at Main/::frame25()
In my main document class, I define this public variable:
var gameData:SharedObject = SharedObject.getLocal("saveData");//Store highscores and player data
here is the function that is causing the error:
public function ClearScores():void{
//scoreData.data.bests = new Array(["NoOne",0],["NoOne",0],["NoOne",0]);
gameData.data.bests = new Array();
gameData.data.totals = new Array();
gameData.data.averages = new Array();
trace(gameData.data.bests);
ScoreReset(gameData.data.bests);
ScoreReset(gameData.data.totals);
ScoreReset(gameData.data.averages);
gameData.flush();
trace("GAME DATA:
"+gameData.data.bests);
function ScoreReset(theScore:Array):void{
var i:int;
for(i = 0; i <= 2;i++){ //keep up to 3 scores
theScore*[0] = "NoScore";
theScore*[1] = 0;
}
}
Any help would be great. Thanks in advance.