Game Development Reference
In-Depth Information
static public const STATUS_MESSAGE_ERROR:String = " An error
occurred when retrieving scores.\nPlease try again later. " ;
static private var _netConnection:NetConnection;
The static constants for the leaderboard are the URL of the AMF
secret key value that will be used for security purposes, the number
of results to pull from the database, and the text to display in the
event of an error (like the lack of an Internet connection). A refer-
ence to a NetConnection object is also created, as this will be how
the AMF communication is handled.
static public function createConnection():void
if (!_netConnection)
_netConnection = new NetConnection();
static public function saveScore(score:int, initials:String)
var responder:Responder = new Responder(onScoreSaved,
var date:Date = new Date();
var hash:String = MD5.hash(MD5.hash(SECRET_KEY + score +
initials + date.toString())); " games.HighScores.saveScore " ,
responder, GAME_ID, score, initials, date.toString(), hash);
static private function onScoreSaved(result:Object):void
Score Saved:
static private function onScoreSaveError(result:Object):void
Any time a call to the AMF service is made; createConnection is
called to make sure the NetConnection has been established. When
a score is saved to the database, which can be done from any other
Search Nedrilad ::

Custom Search