mardi 22 septembre 2015

save load error 1010 array objects with sharedObjects as3

i cant figure out this one so maby you guys can help me out.

i store some data in the form of a array filled with Objects in this example cards.

in my main class i have the following code:

deckSprite.savedData = SharedObject.getLocal("cardsdata");
deckSprite.savedData.data.savedArray = deckSprite.deckArr;
deckSprite.savedData.flush();
trace(deckSprite.savedData.data.savedArray);

the trace will output something like [object card1, object card2, object card3]

now in a static class called "deckSprite" i have this:

savedData = sharedObject.getLocal("cardsdata");
if (savedData.data.savedArray == undefined)
{
trace("no save yet");
}
{
else
{
trace("save loaded");
deckArr = savedData.data.savedArray;
trace(savedData.data.savedArray);

now my trace data turns out only ", ," (somehow the cards are gone).

now after i got saved data i restart my application and whenever he tryes to acces the deckArr it crashes giving me the error "A term is undefined and has no properties".

how is it possible that when i save the array it saves all the cards inside the array and when i restart the application its suddenly only ",,"but the cards are gone?

Aucun commentaire:

Enregistrer un commentaire