How Info Is Stored

[ LiB ]

How Info Is Stored

Once information from a form is on the server side, the CGI script can pretty much do anything it wants with it, including leaving the information just as it was sent and saving into a text file on the server. Let's check out an example of information stored in this manner:

 name=Lewis%2CJudy%2CJulie&score=321%2C213%2C465 

What in the world is that ? It's encrypted, but once I let you in on the secret it's not so bad. Allow me to break it downthere are two key-value pairs here, which are pairings of a key (the name of a value) and a value (the value itself). Our two variables (keys) are name and score; let's see what their values are.

But before we do that, let me quickly explain that when sending data over the Internet, spaces and commas and a few other characters are not allowed; special codes have been invented to represent these characters . The character combination %2C represents a comma. Don't worry though; you won't have to memorize all these codes because there's an object in ActionScript that converts them for you. Take a look at the line againthis time with no %2Cs, only commas.

 name=Lewis,Judy,Julie&score=321,213,465 

Ah, seems clearer. Now let's divide the valued pairs. This is what I ended up with:

 name=Lewis,Judy,Julie 

And

 score=321,213,465 

Let's say you had some information, such as a high score list, stored away on the server; you can have Flash load this information into the program and access these pairs. If Flash loads pairs like these in, they will be in string form. In order to access the individual values within these properties, you could use the split command to store them in an array. This will give you full access to Lewis, Judy, and Julie and also to their scores. How cool is that?

[ LiB ]


Game Development with ActionScript
Game Development with ActionScript
ISBN: 1592001106
EAN: 2147483647
Year: 2004
Pages: 162
Authors: Lewis Moronta

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net