# Using SharedObjects properly

**URL:** <https://forum.kirupa.com/t/using-sharedobjects-properly/300802>\
**Category:** flash\
**Created:** [November 27, 2009, 9:36pm UTC](https://forum.kirupa.com/t/using-sharedobjects-properly/300802 "2009-11-27T21:36:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jik\_ff](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jik\_ff](https://forum.kirupa.com/u/jik_ff)\
**Post date:** [November 27, 2009, 9:36pm UTC](https://forum.kirupa.com/t/using-sharedobjects-properly/300802/1 "2009-11-27T21:36:38Z")

</div>

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:

```auto
  var gameData:SharedObject = SharedObject.getLocal("saveData");//Store highscores and player data

```

here is the function that is causing the error:

```auto
 
  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.
