00:00
00:00
Newgrounds Background Image Theme

Weezyfresh 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!

Good save and load AS

631 Views | 9 Replies
New Topic Respond to this Topic

Good save and load AS 2006-07-27 23:21:47


OK, I've used Save/load codes from tutorials, AS:main, etc. AND NONE WORK.

So, if someone can give me a 100% surefire code--I'll need it!!!!

One for a save button and a load button.

Response to Good save and load AS 2006-07-27 23:23:07


The code given in the AS: Main save/load tutorial is 100% function and teaches it VERY well.

I'm not sure what else you can possibly want.

Response to Good save and load AS 2006-07-27 23:50:48


At 7/27/06 11:23 PM, GamesCool wrote: The code given in the AS: Main save/load tutorial is 100% functional and teaches it VERY well.

I'm not sure what else you can possibly want.

It doesn't work. What am I doing wrong?

On load button:

on (press) {
var savefile = SharedObject.getLocal("savefile");
if (savefile.data.score == undefined) {
_root.score = 0;
_root.level = 0;
} else {
_root.score = savefile.data.score;
_root.level = savefile.data.level;
}
}

On save button:

on (press){
savefile.data.score=_root.score;
savefile.data.level=_root.level_mc;
savefile.flush();
}

Response to Good save and load AS 2006-07-27 23:56:59


What happens when you try it?

Response to Good save and load AS 2006-07-27 23:59:40


Ummm... I press the save button, refresh the page, press the load button, and nothing happens.

Response to Good save and load AS 2006-07-28 00:06:41


OK. Here's the code I would use to test it, because the values you're getting might be wrong.

on (press) {
savefile = SharedObject.getLocal("savefile");
_root.tempscore = savefile.data.score;
_root.templevel = savefile.data.level;
trace("score is: " + _root.tempscore " and level is: " + _root.templevel);
}

On save button:

on (press){
savefile = SharedObject.getLocal("savefile");
savefile.data.score=50;
savefile.data.level=_12;
savefile.flush();
}

Response to Good save and load AS 2006-07-28 00:07:51


Whoops. My bad.

Change savefile.data.level=_12; to savefile.data.level=12;

Response to Good save and load AS 2006-07-28 00:28:06


Oof. I've got a good feeling 'bout this... but...

**Error** Scene=Scene 1, layer=Layer 15, frame=2:Line 5: ')' or ',' expected
trace("score is: " + _root.tempscore " and level is: " + _root.templevel);

**Error** Scene=Scene 1, layer=Layer 15, frame=2:Line 6: Unexpected '}' encountered
}

Total ActionScript Errors: 2 Reported Errors: 2

Response to Good save and load AS 2006-07-28 01:11:24


Whoops.

My bad.

Make it: trace("score is: " + _root.tempscore + " and level is: " + _root.templevel);

Response to Good save and load AS 2006-07-28 01:28:11


oh if it dosent work changer you flash player settings whoo