Flash Score.easySetScore

From J2Play

Jump to: navigation, search

Contents

Description

Stores an array of score values for the specified user.

Syntax

public function easySetScore(
  username : String,
  values : Array) : Void;

Parameters

* @param username specifies the user name for which the score is set or null to store for the current user.
* @param values specifies the scoring values, it is an array of intergers, please don't send decimal score

Return Value

N/A

Examples

Here is the example to store following game score information:

level = 1
cash = 1000
power = 5

Serialize game score into an array

 // just a sample, uses serialization instread in actual code
 var values = new Array(1,1000,5);

And, then

 //send the score values
 score.easySetScore(
   j2play.getUsername(), // set score for current user
   values);

PAY ATTENTION: when you post single score value. Do it this way

 //send single score value
 score.easySetScore(
   j2play.getUsername(), // set score for current user
   [ score_value ]);
Personal tools