First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Glen Rhodes | Website: http://www.glenrhodes.com

Calling it

Okay, so now you want to do something with the highscore table. Well, the simplest thing to do is display the list in a web browser.

For argument's sake, let's imagine that our website is at www.myscore.com

The following,

http://www.myscore.com/scores.php?filename=scores/score.sco&scoresize=10&action=VIEW&viewtype=HTML

when placed in the address bar at the top of a web browser, and run for the first time, will produce a table containing our highscore list. The table will appear like so:

# Name Score
1none0
2none0
3none0
4none0
5none0
6none0
7none0
8none0
9none0
10none0

When you run that command for the first time, the file that stores the scores will be created. This file is a simple text file that uses special PHP encoded strings to store our data. We are passing several values to the PHP script itself.

  • filename: This is the name of the file, including path, that will store the scores for a game. For example, for a game called "Funhouse" you would set filename to be scores/funhouse.sco. The name is up to you, but use a different name for different games.
  • scoresize: This is the number of scores to keep in the list. In the above example, we are using a 10 score database, so scoresize is equal to 10.
  • action: The action parameter is very important. It can be set to INSERT, CLEAR, or VIEW. When it's set to VIEW, then our PHP script simply reads the list from the database and makes no changes. When action is set to CLEAR, all the entries in the table are cleared (name=none, score=0). I'll get to INSERT in a minute.
  • viewtype: This parameter can be set to either "HTML" or "FLASH". When it's set to HTML, then it returns the formatted table displayed above. However, when it's set to FLASH, then it returns a stream of Flash variables.

Let's try the command like so:

http://www.myscore.com/scores.php?filename=scores/score.sco&scoresize=10&action=VIEW&viewtype=FLASH

When this is placed in the address bar of a web browser, the following string is returned:

NAME0=none&SCORE0=0&NAME1=none&SCORE1=0&NAME2=none&SCORE2=0&

etc... up to

NAME9=none&SCORE9=0&

This happens to be the way Flash expects variables to be returned to it in order to use them properly.

» Level Intermediate

Added: 2001-08-24
Rating: 7.82 Votes: 384
(10 being the highest)
» Author
No details available
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.