Flash ScoreManager.easyGetScore
From J2Play
Contents |
Description
Gets an array of score values for specific user
Syntax
public function easyGetScores( username : String, callback : Callback) : Void;
Parameters
* @param username specifies the user name for which the score is get * @param callback the callback object which present the function to be called on successful scores retrieval. * The callback function will be called with an array of score values
Return Value
N/A
Examples
Here is the example to restore saved game score information: First, makes a function to handle the result
function onScore(values : Array) : Void
{
// 'values' is array of score values which you send to easySetScore
// you can unserialize from the array to get all score values to variables
}
And, then
// make a callback object // if onScore is a class member function, you should passed in object a instance of the class (e.g. this); // otherwise, you can ignore this parameter var callback : ca.j2x.flash.Callback = new ca.j2x.flash.Callback(onScore,object); // get score, if success, it callbacks the onScore scoreManager.easyGetScore( controller.getUsername(), // get score for current user callback);
