View Full Version : [AS2] Save Game?
12-04-2008, 06:24 PM
Alright, so I'm down to this. My game needs to be able to save data.
Say for example: I have Dynamic Text as a movie clip. The MC instance name is score, and the dynamic text instance is score. SO! This MC has this tini-weenee code:
this.score.text = 0;
}Now, say, if my player wishes to save and close the game, how would the player be able to save the score that is inside this MC? D:
12-04-2008, 10:38 PM
I could use an example, if you please. I've never used localInfo = SharedObject.getLocal(); if that's what you mean.
(?): How can the score.text that's inside the score mc be saved into the player's hard drive, THEN be called back when the player runs the game again? :o
12-04-2008, 11:17 PM
This question is asked often. Flash cannot save files. Most people use php to save files, usually .txt or .xml, to the server where the swf is. In short, you need to use a php script on the same server as your flash swf, since flash can't write to files, but php can, and flash can communicate with php. You could alternatively use Adobe Air, or some 3rd party projector software.
this thread has a fairly thorough discussion, including example php files:
The request, if I understood it correctly, was to save and resume score.
To do that with php, you have to manage the user identity too, which I think wouldn't
be too easy and "distract" from the real task.
To me the easiest way is to use shared object, you play the game, decide to exit so
save the score and close. Once you reload the flash, it resumes the score from the
shared object (much like login forms "remember me").
Of course this solution would manage only one user per machine.
As a reference you can see this:
12-08-2008, 06:45 AM
Thanks it works ....
09-06-2009, 12:32 AM
I know this topic is old, but can someone give me an example of how to use
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.