title: How to properly save array of classes via StoredObject? (AS3)
body: <p>in my current program, I have a class that acts as a container for relevant data. Let's say it's a <code>Person</code> class. <code>Person</code> has a private <code>myAge:int</code> attribute that gets set when the program runs. In addition, the Person is added to an array  and saved. Then all of the people from the array are called and ages are traced. Here is the main code of interest:</p>
  
  <pre><code>// In the Document class. 
  registerClassAlias("Person", Person); 
  registerClassAlias("AddressBook", AddressBook);
  myAddressBook = new AddressBook();
  myAddressBook.addNewPerson(75);
  
  
  // In the AddressBook class when a new AddressBook is created:
  // I load the addressEntries, which is an array that will contain instances of Person class.
  </code></pre>
  
  <p><code>sharedObjectAddressEntries = SharedObject.getLocal("storedAddressEntries");</code></p>
  
  <pre><code>if(sharedObjectAddressEntries.data.storedAddressEntries != null)
  {
      addressEntries = sharedObjectAddressEntries.data.storedAddressEntries;
  }
      else
      {
          addressEntries = new Array();
      }
  
  // This is what I do to add a Person to the array:
  var aPersonEntry:Person = new Person();
  aPersonEntry.addAge(anAge); // This just sets private field to anAge.
  addressEntries.push(aPersonEntry);
  saveStoredPeople();       
  
  //This is how I save them:
  sharedObjectAddressEntries.data.storedAddressEntries = addressEntries;
  
          sharedObjectAddressEntries.flush();
  </code></pre>
  
  <p>And after that I loop through the array to display each age. The important thing to note is that only the ages set during the current program load. All of the ones from previous runs are saved in that the array is still filled with People, but all of their ages are now set to 0.</p>
  
  <p>Any help with this would be greatly appreciated, nothing I seemed to find has helped.</p>