dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Saving games (yes, another savegame thread)

  1. #1
    Senior Member
    Join Date
    Sep 2008
    Posts
    121

    Saving games (yes, another savegame thread)

    Been looking through ALL save/load threads here, all I've read only deals with shared objects, but to my understanding that is only good for saving on the player's harddrive. What would I need to save on a server (online)? Cause I don't like the idea of the savefiles being stored on the player's HDD.

    I got no skill in php, mysql or whatever could be needed for this, so I hope there might be a ready-made tiny save/load script somewhere.

    Thanks.

  2. #2
    President PhobiK's Avatar
    Join Date
    Jan 2005
    Location
    Guatemala
    Posts
    918
    I haven't heard of other way of doing what you want rather than using php, usually with mysql. I'm not up to date with AS3 so I don't know if there is a way already. If not, you can still go the php way, it's not too difficult and you'll certainly find some easy tutorials out there just to copy, paste and change some variables. Php is very similar to actionscript. What you will need is to have a mysql database in your server.
    This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.

    This is my Blog!... The gaming Process
    Please check out my site: Giddel Creations

  3. #3
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176

  4. #4
    Senior Member Draxus's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    123
    I use this to save to an XML file:

    PHP Code:
    <?php
    //--- Load XML ---
    $flashRAW file_get_contents("php://input");
    $flashXML simplexml_load_string($flashRAW);

    //--- load in xml file to edit.  if doesnt exist, create ---
    $xmlFile "levelData.xml";
    $xmlHandle fopen($xmlFile"w");

    //--- set xml as string to be written ---
    $xmlString $flashXML->asXML();
    echo(
    $xmlString);

    //--- write xml to file ---
    fwrite($xmlHandle$xmlString);

    //--- close out xml file ---
    fclose($xmlHandle);
    ?>
    I didn't write it though and I don't know very much PHP... you shouldn't need any PHP knowledge to implement it.

    Just change $xmlFile = "levelData.xml" to reflect your file name.
    Last edited by Draxus; 07-22-2009 at 11:26 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center