all groups > flash data integration > october 2006 >
You're in the

flash data integration

group:

User/Score XML file integration


User/Score XML file integration Golbez_AU
10/20/2006 12:00:00 AM
flash data integration:
Hi, i've got a project due in around one year from now. One of the main
features i'd like to include in this project is the ability to save/load a user
and their score.

I've had a look at some tutorials and it seems that a local XML file would be
the easiest way to go, but i haven't quite found anything that really suits my
needs.

So basically i'd like for it to have a list of users and their scores (this
involves parsing the XML file and setting the strings to variables right?) and
then be able to log in (is it possible to create new users through flash??),
then after gaining more points, their score is updated in the XML file.

Any suggestions as to where i should start with this?
Re: User/Score XML file integration TimSymons
10/20/2006 5:11:18 PM
Will this be available through a website? or will it be something like a
downloadable game that they run locally?

If this will be on a website, then to store new or update information into an
XML file you will need to use a serverscripting language like ASP or PHP or
whatever language you like.

If it will running locally on a person system, after downloading, then you can
use the SharedObject class to store information on their system about their
progress in the program. It functions like JavaScript cookies so it won't be
XML but it will do the job.

Tim
Re: User/Score XML file integration Golbez_AU
10/21/2006 12:00:00 AM
Right now i intend for it to be installed locally.

With the SharedObject class, where does that save the information? Is it in a
separate file or what?

How hard would it be to implement a system where you could select which user
to continue with/create a new user?

Once it's implemented, is it as simple as loading the score associated with
that username as a variable?

Sorry for the uneducated questions, it's just that i want to know which
direction i should be heading in so that i can begin planning/experimenting for
my project.
Re: User/Score XML file integration Moonster
10/21/2006 10:51:27 PM
You should go with the ShareObject I think. The shared object stores the
data in a Flash specific location (C:\Documents and
Settings\[USER]\Application Data\Macromedia\Flash Player)

All you do is creating a local SharedObject and then store data in it -
this data can be read again later on in a new session. It works like a
cookie.

Try look in the Flash help on SharedObject :)

Or try this code:


var so:SharedObject = SharedObject.getLocal("userHighScore");

if (so.data.highScore == undefined)
{
trace("no high-score found");
}
else
{
trace("high-score = "+so.data.highScore);
}

// set a new highscore:
so.data.highScore = Math.ceil(Math.random() * 1000);
so.flush();

trace("new high-score = "+so.data.highScore);


- Magnus




[quoted text, click to view]
AddThis Social Bookmark Button