00:00
00:00
Newgrounds Background Image Theme

MutantZulu81241 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

help me save a variable in ng api

435 Views | 1 Reply
New Topic Respond to this Topic

let's say i have a variable named as foo and its value is 1234 and i want to save it with save method(if there is) how can i proceed and also how can i load the foo value ?! help me please. (i am using as3)

Response to help me save a variable in ng api 2014-12-27 21:59:31


According to the wiki, you should just be able to do this:

var file:SaveFile = API.createSaveFile("groupName");
file.data = {
 "blah": "test",
 "blah2": true
};
file.save();

var file2:SaveFile = API.loadSaveFile(0, true);
trace(file2.data.blah); //"test"
trace(file2.data.blah2) //true

Though that's untested code, so yeah.

Alternatively, use local saves.

var data:Object = {
 "blah": "test",
 "blah2": true
};

API.saveLocal(0, data);

var data2:Object = API.loadLocal(0);
trace(data2.blah); //"test"
trace(data2.blah2); //true

Also untested, but I'm pretty sure that will work.


Programming stuffs (tutorials and extras)

PM me (instead of MintPaw) if you're confuzzled.

thank Skaren for the sig :P

BBS Signature