02.02.2013 Views

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

12<br />

Using external files<br />

When you are using <strong>Flash</strong>, the target platform for your game is usually the web. Your game<br />

will be seen in a browser. In order for your game <strong>to</strong> be available on the web it will need <strong>to</strong><br />

reside on a server that can be accessed from the web. In most cases this will mean that the<br />

game is on a computer belonging <strong>to</strong> an ISP (Internet Service Provider). If you work for a big<br />

company then you may well have one or more servers that are accessible from the web, but<br />

for home and small business users this accessibility is usual provided by a third party. Once your<br />

game is accessible <strong>to</strong> the world via the Internet you may want your game <strong>to</strong> have several levels<br />

or you may want the ability <strong>to</strong> easily change the game monthly, weekly or even daily. You<br />

may want the game <strong>to</strong> perform slightly differently for different users. To achieve these goals<br />

you may have the different versions of the game on the server or the behaviour of the game<br />

could be influenced using an external file. In this chapter we will look at using a simple text file<br />

containing variable data so that the game you have created behaves differently by using different<br />

configuration text files. Another popular method for setting the configuration data is <strong>to</strong> use ASP<br />

(Active Server Pages). ASP is often used <strong>to</strong> link <strong>to</strong> databases on the server. Using a link <strong>to</strong><br />

the database the game can be easily updated or made <strong>to</strong> have a unique configuration for the<br />

current user.<br />

A brief overview of the web<br />

You probably already know about the web and how <strong>to</strong> use it but if not here’s the briefest of brief<br />

introductions. The web was the brainchild of Tim Berners-Lee, who came up with a common<br />

standard for hyperlinked documents across a network. He invented the acronym that we have all<br />

come <strong>to</strong> love, HTML (Hyper Text Mark-up Language). We link <strong>to</strong> an HTML document using<br />

HTTP (Hyper Text Transfer Pro<strong>to</strong>col). Everything on the web has a URL (Uniform Resource<br />

Loca<strong>to</strong>r). The URL for the home page for this book is<br />

http://www.niklever.net/flash/index.html<br />

‘http’ indicates the pro<strong>to</strong>col, ‘www.niklever.net’ directs the browser <strong>to</strong> the appropriate folder on<br />

the appropriate server. Basically, the name is just a link in<strong>to</strong> a big look-up table that finds the<br />

IP address of the computer. An IP address will have the form XXX.XXX.XXX.XXX, where<br />

XXX is a number up <strong>to</strong> 255. Although interesting, so far none of this is directly relevant <strong>to</strong> you<br />

as a developer. Where it gets more interesting is the document itself, the HTML page. In this<br />

example we have ‘index.html’, although because the server defaults <strong>to</strong> this file and because HTTP<br />

168

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!