Flash Leaderboards

From J2Play

Jump to: navigation, search

J2Play leaderboards list and store the best scores of a game.

Contents

Acquire the score interface

To use the leaderboard feature, start by acquiring a reference to the score interface:

ActionScript 2

import ca.j2x.flash.IScoreManager;
import ca.j2x.flash.IController;

var j2play:IController = _global.controller;
var scoreManager: IScoreManager = j2play.getScore();

ActionScript 3

import ca.j2x.flash.lang.Global;
import ca.j2x.flash.IScoreManager;
import ca.j2x.flash.IController;

var j2play:IController = Global.vars.controller;
var scoreManager: IScoreManager = j2play.getScore();

Easy way to set/get score

This simple API stores one record per player in the leaderboard and updates that score if the new score passed to it is better than the previous one.

More flexible way to set/get score

This method is very flexible and provides a full range of options, including sending multiple scores.

Enabling Leaderboards

To enable leaderboards follow these steps

1. Edit your game in the J2Play Management Console and select the Game tab
Image:Leaderboard1.png
2. Under Integrated features make sure that leaderboards is checked


3. Navigate to the Score tab
Image:Leaderboard2.png
4. For each score type you want to appear in the leaderboard enter in the score type of that score, a human readable label, whether or not higher scores are better, and the desired display format for the score into the very last row of the table
Note: If you are using ScoreManager.easySetScore use Record as the score type for the score
5. Click the Add button to add the score to the table and click Save when all of the data has been entered
Please allow up to 30 minutes for the data to appear in the system

Links

Personal tools