Forum BigDB array rollbacks to previous state after save()

Discussion and help relating to the PlayerIO database solution, BigDB.

array rollbacks to previous state after save()

Postby Khai » April 11th, 2013, 11:11 am

I have a weird problem here, this problem appears only occassionally, damn frustrated about it.
More descriptions in Comments.

Code: Select all
//For example obj.ITEM = [[1,9],[2,2],[3,3],[4,4]];
Connect.client.bigDB.load("DatabaseName", String(User.id), function(obj:DatabaseObject):void{
var itemArr:Array = obj.ITEM;

//I make some updates to the array, for example:
itemArr = [[1,1],[2,2],[3,3],[4,4]];

/* Updating the inventory variable.
    User.item is an Array which I call the player's item array */
User.item = itemArr;
//This trace shows the correct updated array: [[1,1],[2,2],[3,3],[4,4]]
trace(User.item);

//This trace, after save it shows the old one: [[1,9],[2,2],[3,3],[4,4]]
obj.save(false,false,function():void{trace("Post Save", User.item);});


Can anyone help me on this? Let me know if you need more info to solve this.
So if now I call the "User.item" on other functions it still appears to be the old one. but my BigDB is the correctly updated.
Khai
 
Posts: 2
Joined: November 7th, 2012, 4:45 am

Return to BigDB