Packagecom.myflashlab.air.extensions.googleGames
Classpublic class Leaderboards
InheritanceLeaderboards Inheritance flash.events.EventDispatcher

A client to interact with leaderboards functionality.



Public Methods
 MethodDefined By
  
loadCurrentPlayerScore($leaderboardId:String, $timeSpan:int):void
Asynchronously loads signed-in player's score for the leaderboard specified by $leaderboardId.
Leaderboards
  
loadMetadata($leaderboardId:String, $forceReload:Boolean):void
load a specific leaderboard's metadata for this game or load the list of leaderboard metadata for this game.
Leaderboards
  
loadMoreScores($pageDirection:int):Boolean
Loads an Array of Score instances that represents an additional page of score data based on the former call to load scores.
Leaderboards
  
loadPlayerCenteredScores($leaderboardId:String, $timeSpan:int, $maxResults:int, $forceReload:Boolean):void
Loads an Array of Score instances that represents the player-centered page of scores for the leaderboard specified by leaderboardId.
Leaderboards
  
loadTopScores($leaderboardId:String, $timeSpan:int, $maxResults:int, $forceReload:Boolean):void
Loads an Array of Score instances that represents the top page of scores for a given leaderboard specified by leaderboardId.
Leaderboards
  
showNativeWindow($leaderboardId:String, $timeSpan:int):void
Show a leaderboard for a game specified by a leaderboardId in the specified timespan.
Leaderboards
  
Show the list of all leaderboards for a game
Leaderboards
  
submitScore($leaderboardId:String, $rawScore:int, $metadata:String, $immediate:Boolean):void
submits the score to the leaderboard for the currently signed-in player.
Leaderboards
Public Constants
 ConstantDefined By
  TIME_SPAN_ALL_TIME : int = 2
[static] Scores are never reset.
Leaderboards
  TIME_SPAN_DAILY : int = 0
[static] Scores are reset every day.
Leaderboards
  TIME_SPAN_WEEKLY : int = 1
[static] Scores are reset once per week.
Leaderboards
Method Detail
loadCurrentPlayerScore()method
public function loadCurrentPlayerScore($leaderboardId:String, $timeSpan:int):void

Asynchronously loads signed-in player's score for the leaderboard specified by $leaderboardId. Result will be dispatched through LEADERBOARDS_LOAD_PLAYER_SCORE_RESULT.

Parameters

$leaderboardId:String — ID of the leaderboard to load the score from.
 
$timeSpan:int — Time span to retrieve data for. Valid values are TIME_SPAN_DAILY, TIME_SPAN_WEEKLY, or TIME_SPAN_ALL_TIME.

loadMetadata()method 
public function loadMetadata($leaderboardId:String, $forceReload:Boolean):void

load a specific leaderboard's metadata for this game or load the list of leaderboard metadata for this game. Result will be dispatched through LEADERBOARDS_LOAD_META_DATA_RESULT.

Parameters

$leaderboardId:String — ID of the leaderboard to load metadata for or null to load the list of leaderboard metadata for this game
 
$forceReload:Boolean — If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching.

loadMoreScores()method 
public function loadMoreScores($pageDirection:int):Boolean

Loads an Array of Score instances that represents an additional page of score data based on the former call to load scores. Result will be returned through LEADERBOARDS_LOAD_SCORES_RESULT.

Parameters

$pageDirection:int — The direction to expand the buffer. values can be: Games.PAGE_DIRECTION_NONE, Games.PAGE_DIRECTION_NEXT or Games.PAGE_DIRECTION_PREV

Returns
Boolean — returns true if more scores can be returned.
loadPlayerCenteredScores()method 
public function loadPlayerCenteredScores($leaderboardId:String, $timeSpan:int, $maxResults:int, $forceReload:Boolean):void

Loads an Array of Score instances that represents the player-centered page of scores for the leaderboard specified by leaderboardId. If the player does not have a score on this leaderboard, this call will return the top page instead. Result will be returned through LEADERBOARDS_LOAD_SCORES_RESULT.

Parameters

$leaderboardId:String — ID of the leaderboard.
 
$timeSpan:int — Time span to retrieve data for. Valid values are TIME_SPAN_DAILY, TIME_SPAN_WEEKLY, or TIME_SPAN_ALL_TIME.
 
$maxResults:int — The maximum number of scores to fetch per page. Must be between 1 and 25.
 
$forceReload:Boolean — If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching.

loadTopScores()method 
public function loadTopScores($leaderboardId:String, $timeSpan:int, $maxResults:int, $forceReload:Boolean):void

Loads an Array of Score instances that represents the top page of scores for a given leaderboard specified by leaderboardId. Result will be returned through LEADERBOARDS_LOAD_SCORES_RESULT.

Parameters

$leaderboardId:String — ID of the leaderboard.
 
$timeSpan:int — Time span to retrieve data for. Valid values are TIME_SPAN_DAILY, TIME_SPAN_WEEKLY, or TIME_SPAN_ALL_TIME.
 
$maxResults:int — The maximum number of scores to fetch per page. Must be between 1 and 25.
 
$forceReload:Boolean — If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching.

showNativeWindow()method 
public function showNativeWindow($leaderboardId:String, $timeSpan:int):void

Show a leaderboard for a game specified by a leaderboardId in the specified timespan.

Parameters

$leaderboardId:String — The ID of the leaderboard to view.
 
$timeSpan:int — Time span to retrieve data for. Valid values are TIME_SPAN_DAILY, TIME_SPAN_WEEKLY, or TIME_SPAN_ALL_TIME.

showNativeWindowAll()method 
public function showNativeWindowAll():void

Show the list of all leaderboards for a game

submitScore()method 
public function submitScore($leaderboardId:String, $rawScore:int, $metadata:String, $immediate:Boolean):void

submits the score to the leaderboard for the currently signed-in player. The score is ignored if it is worse (as defined by the leaderboard configuration) than a previously submitted score or the same player.

if the $immediate param is set to true, it will submit the score to the server immediately. The result will be returned with LEADERBOARDS_SUBMIT_SCORE_RESULT event.

The meaning of the score value depends on the formatting of the leaderboard established in the developer console. Leaderboards support the following score formats:

For more details, please see this page: https://developers.google.com/games/services/common/concepts/leaderboards">

Parameters

$leaderboardId:String — The leaderboard to submit the score to.
 
$rawScore:int — The raw score value.
 
$metadata:String — Optional metadata about this score. The value may contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.
 
$immediate:Boolean — If true, score will be submitted to server immediately and results will be dispatched through LEADERBOARDS_SUBMIT_SCORE_RESULT

Constant Detail
TIME_SPAN_ALL_TIMEConstant
public static const TIME_SPAN_ALL_TIME:int = 2

Scores are never reset.

TIME_SPAN_DAILYConstant 
public static const TIME_SPAN_DAILY:int = 0

Scores are reset every day. The reset occurs at 11:59PM PST.

TIME_SPAN_WEEKLYConstant 
public static const TIME_SPAN_WEEKLY:int = 1

Scores are reset once per week. The reset occurs at 11:59PM PST on Sunday.