6 Replies Latest reply on Oct 10, 2007 5:11 AM by Venian

    How can i record a name a score in a flash game and write down in a soreboard?

    Venian Level 2
      Hi. I wrote down the summary of my project so that you can understand and answer me more easily:

      I have to build an application (a little flash game) in which I record the number of clicks. I want the player to choose a nick at the beginning and when he finishes one or all the four choices of target, i want the application to write his nick and final score in a database for displaying in a scoreboard (hall of fame). All the new entries should be sorted according to the score. If the same nick appears again, it's final score will be modified in the scoreboard only if is higher then the previous.

      I was thinking of creating a variable for the name that is chosen at the beginning and a variable for the score that is recorded. When the player finishes the game i want the application to write his data in the database, and then to display the scoreboard (let's say top 10 players in the database from the highest to the lowest score).

      I never did this before so i am asking what database shoud i use? I need a programmer to create one for me? Or can flash generate the database?

      Is the variable the good way or should I aproach the problem by other means? And if a programmer creates a database in MySql is that good or he should convert it to XML, or Flash generates the XML?

      Thank you.


      Mark this message as the answer.
        • 1. Re: How can i record a name a score in a flash game and write down in a soreboard?
          Sivakanesh Level 1
          The bottom line is you cannot write to a file (database or XML files) directly from flash.
          I have done a number of projects where I needed to have access to an XML source or a database. In these cases I had to create server side script. I have done them in .NET, PHP ASP.

          The only option you have is to use the Flash's Shared Object. This does not store the data indefinatly and has a limited size (100K). Let me know if you need further info.

          With regards to using a variables depends on how you are writing your game. If you are creating classes in ActionScript then all the data can be stored within the class members. For example you could have a Player Class and store all the player related information in that class until the game is over. On the other hand you can just use varibles to keep things simple.
          • 2. Re: How can i record a name a score in a flash game and write down in a soreboard?
            Venian Level 2
            Yes. I need further info. Thank you very much.

            I don't create classes in AS. I only need that everytime the game is lunched on the website, to record a name and a final score that will be written down in a database from which a scoreboard will be displayed. I need a database because i need to display a scoreboard everytime someone plays. If i store the info in the flash file it will be erased and another player won't see the score of the top 10.

            So I think i will stick to the variables, but how do i store the score for future use?

            Thanks very much, man,
            • 3. Re: How can i record a name a score in a flash game and write down in a soreboard?
              Sivakanesh Level 1
              The only way to record the scores in a database is to write some server side script. So you should check what language/server side script your web host allows.
              Who are you hosting your website with? Your choice of server-side scripting is limited by what server-side technology your host/package allows.
              What ever scripting language you use your requirements are pretty basic. You can just pass and retrieve series of values from your flash game to the server-side script and visa-versa.
              If you are not expecting 100s of simultaneous users you can stick with an Access database. MySQL would be ideal, but some hosts charge a lot of extra money for this.

              Let me know what details you get regarding the web host.
              • 4. Re: How can i record a name a score in a flash game and write down in a soreboard?
                Venian Level 2
                Ok. Thanks for the help, man.

                What do you mean by server-side scripting? An XML file?
                • 5. Re: How can i record a name a score in a flash game and write down in a soreboard?
                  Sivakanesh Level 1
                  No. XML would be a data source, similar to a database.
                  When I say server-side scripting, I mean a piece of code that runs on the server. You can create them in .NET, PHP, classic ASP or several other languages.
                  All swf files, such as your game are downloaded to the the users' PC before they can view it. As long the server is concerned it is just another file. So when your game send the score back to the server from the users' PC, the web server needs to know how to deal with it.
                  If you create some server-side script (regardless of the language), that would handle the data send back from the Game. Also the script would send databack to the game.

                  Hope this make thing more clear. You next step should be finding out what scripting language your web host supports.
                  • 6. Re: How can i record a name a score in a flash game and write down in a soreboard?
                    Venian Level 2
                    Ok. Thanks a lot. You are very helpful.
                    I will find out and get back with the info. Thanks a lot. I think it will take a while 'cuz now i am working to make it work grafficaly.