00:00
00:00
Newgrounds Background Image Theme

BWWAA-LORD-OF-DUCKS just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Browse Sections

Newgrounds Wiki: getScoreBoard

Usage

import com.newgrounds.API;
import com.newgrounds.ScoreBoard;

var board:ScoreBoard = API.getScoreBoard(board_name:String);
  • board_name - The name of the scoreboard you want.

This call gets the ScoreBoard instance with the scoreboard name you have defined.

Examples

The following examples demonstrate how to load the top 20 scores for today from a scoreboard named "High Scores". Note: Scores are returned as Score instances.

Actionscript 3.0

import com.newgrounds.API;
import com.newgrounds.APIEvent;
import com.newgrounds.ScoreBoard;
import com.newgrounds.Score;

// this function will run when the server returns our list of scores function onScoresLoaded(event:APIEvent):void { if (event.success) { var board = event.data.board;

for(var i:uint=0; i<board.scores.length; i++) { var score:Score = board.scores[i];

trace(score.position+": "+score.username+" -- "+score.value); } }

// Tell the api to listen for the SCORES_LOADED event API.addEventListener(APIEvent.SCORES_LOADED, onScoresLoaded);

// get our board and tell it what time period to load up, and how many results var high_scores:ScoreBoard = API.getScoreBoard("High Scores"); high_scores.period = "Today"; high_scores.num_results = 20;

// load the scores from the server high_scores.loadScores();

Actionscript 2.0

import com.newgrounds.API;
import com.newgrounds.APIEvent;
import com.newgrounds.ScoreBoard;
import com.newgrounds.Score;

// this function will run when the server returns our list of scores function onScoresLoaded(event:APIEvent) { if (event.success) { var board = event.data.board;

for(var i:Number=0; i<board.scores.length; i++) { var score:Score = board.scores[i];

trace(score.position+": "+score.username+" -- "+score.value); } }

// Tell the api to listen for the SCORES_LOADED event API.addEventListener(APIEvent.SCORES_LOADED, onScoresLoaded, this);

// get our board and tell it what time period to load up, and how many results var high_scores:ScoreBoard = API.getScoreBoard("High Scores"); high_scores.period = "Today"; high_scores.num_results = 20;

// load the scores from the server high_scores.loadScores();