Daniel Groves

Show Nav

Flash Game: High Scores Page

Published: 4 February 2011

How the high-scores were laoded by combining ActionScript with a server-side PHP script.

This post looks at exactly how I extracted the high-scores form the database via PHP script.

import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;

This first section loads the nessesery class files.


Followed by the stop function to stop the flash file moving back to frame one.

backToMenu.addEventListener(MouseEvent.CLICK, menuLoad);

This line listens for a click event on the back to main menu button and then activates thr function menuLoad which takes the user back to the nenu on frame one.

function textLoadComplete(event:Event):void
        txtBox.htmlText = textLoader.data;

This function is called by the event listener (below) in order to display the high-scores which are loaded from a server-side PHP script.

var textLoader:URLLoader = new URLLoader();
var textReq:URLRequest = new URLRequest("http://files.danielgroves.net/circuitRacerScores.php");

textLoader.addEventListener(Event.COMPLETE, textLoadComplete);

This is the section of action script that fetches the PHP files that fetches the high scores, and then returns the results to the document.

function menuLoad(event:Event):void



The final function that takes the user back to the main menu when activated.

comments powered by Disqus