Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 12-04-2008, 06:24 PM   #1
Mayhew
Registered User
 
Join Date: Sep 2008
Location: Florida
Posts: 9
Default [AS2] Save Game?

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:
ActionScript Code:
onClipEvent(load){ 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:

Last edited by Mayhew; 12-04-2008 at 10:43 PM.
Mayhew is offline   Reply With Quote
Old 12-04-2008, 09:28 PM   #2
fnx
fearless
 
Join Date: Feb 2008
Location: Italy
Posts: 49
Default

Using shared objects?
__________________
Federico "FNX" Nisoli
Lead Programmer - FNX Games
http://www.fnxgames.com
http://fnxdevbox.blogspot.com
fnx is offline   Reply With Quote
Old 12-04-2008, 10:38 PM   #3
Mayhew
Registered User
 
Join Date: Sep 2008
Location: Florida
Posts: 9
Red face .__.

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?

Last edited by Mayhew; 12-04-2008 at 10:43 PM.
Mayhew is offline   Reply With Quote
Old 12-04-2008, 11:17 PM   #4
dialectric
Senior Member
 
dialectric's Avatar
 
Join Date: May 2006
Location: USA
Posts: 614
Default

Hi,

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:
http://www.actionscript.org/forums/s....php3?t=168250

- dialectric
dialectric is offline   Reply With Quote
Old 12-05-2008, 10:13 AM   #5
fnx
fearless
 
Join Date: Feb 2008
Location: Italy
Posts: 49
Default

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:
http://livedocs.adobe.com/flash/9.0/...redObject.html
__________________
Federico "FNX" Nisoli
Lead Programmer - FNX Games
http://www.fnxgames.com
http://fnxdevbox.blogspot.com
fnx is offline   Reply With Quote
Old 12-08-2008, 06:45 AM   #6
Komal Sharma
Registered User
 
Join Date: Dec 2008
Posts: 3
Default

Hi
Thanks it works ....
Komal Sharma is offline   Reply With Quote
Old 09-06-2009, 12:32 AM   #7
raikado
Flash Toddler
 
raikado's Avatar
 
Join Date: Jun 2009
Posts: 113
Default

I know this topic is old, but can someone give me an example of how to use
sharedOject()?
raikado is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Q] How to Save Text File in Flash??? CyanBlue Other Flash General Questions 7 03-12-2012 09:16 AM
WASD game hegerp Gaming and Game Development 0 10-17-2007 09:34 AM
Flash Game ppllt Gaming and Game Development 1 09-28-2007 03:20 PM
ActionScript Programmer needed for online boxing card game MarkyX Projects and Positions 0 07-10-2006 03:05 AM
Augh. Too many ways to skin a cat. (game design q's) beau Gaming and Game Development 0 01-14-2005 07:08 PM


All times are GMT. The time now is 11:29 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.