I’m working on an advergame with a high score board. My tech guy gave me this and I have no idea how to implement it. I just need to know:
- what to put on the button that submits the score
- what variables to assign to text boxes to display the high scores
Also, why do I get tons of errors when I check this? Is this normal for AS2? or is this code totally useless?
//This code can be directly copied and pasted onto frame 1 and should work
//practically as is. Obviously this is not recommended practice but it should
//give you a head start
import mx.remoting.*;
import mx.rpc.*;
import mx.utils.Delegate;
import mx.remoting.debug.NetDebug;
//Change the gateway URL as needed
var gatewayUrl:String = "http://2003.pepsi.stg.dal.tribalddb.com/amfphp/gateway.php";
NetDebug.initialize();
service = new Service(gatewayUrl, null, "MotorolaGame");
//Save game score under user's account.
function saveGameScore(Array, Array, Array)
{
var pc:PendingCall = service.saveGameScore(user_name, score, user_id);
pc.responder = new RelayResponder(this, "handleSaveGameScore", null);
}
//Get top score list including user_nm, score, and achievement date.
function getGameTopScorerList(Array)
{
var pc:PendingCall = service.getGameTopScorerList(num_entries);
pc.responder = new RelayResponder(this, "handleGetGameTopScorerList", null);
}
//returns method table contents
function getMethodTable()
{
var pc:PendingCall = service.getMethodTable();
pc.responder = new RelayResponder(this, "han dleGetMethodTable", null);
}
function handleSaveGameScore(re:ResultEvent)
{
//Implement custom callback code
}
function handleGetGameTopScorerList(re:ResultEvent)
{
//Implement custom callback code
}
function handleGetMethodTable(re:ResultEvent)
{
//Implement custom callback code
}