Packagecom.myflashlab.air.extensions.googleGames
Classpublic class Achievements
InheritanceAchievements Inheritance flash.events.EventDispatcher

A client to interact with achievements functionality.



Public Methods
 MethodDefined By
  
increment($achievementId:String, $numSteps:int, $immediate:Boolean):void
Increments an achievement by the given number of steps.
Achievements
  
load($forceReload:Boolean):void
loads an Array of achievements that represents the achievement data for the currently signed-in player.
Achievements
  
reveal($achievementId:String, $immediate:Boolean):void
Reveals a hidden achievement to the currently signed-in player.
Achievements
  
setSteps($achievementId:String, $numSteps:int, $immediate:Boolean):void
Sets an achievement to have at least the given number of steps completed.
Achievements
  
loads a native window to show the list of achievements for a game.
Achievements
  
unlock($achievementId:String, $immediate:Boolean):void
Unlocks an achievement for the currently signed in player.
Achievements
Method Detail
increment()method
public function increment($achievementId:String, $numSteps:int, $immediate:Boolean):void

Increments an achievement by the given number of steps. The achievement must be an incremental achievement. Once an achievement reaches at least the maximum number of steps, it will be unlocked automatically. Any further increments will be ignored.

Parameters

$achievementId:String — The ID of the achievement to increment.
 
$numSteps:int — The number of steps to increment by. Must be greater than 0.
 
$immediate:Boolean — If true, it will attempt to update the user's achievement on the server immediately. The Boolean in a successful response indicates whether the achievement is now unlocked. Result will be returned through ACHIEVEMENT_UPDATE_RESULT

load()method 
public function load($forceReload:Boolean):void

loads an Array of achievements that represents the achievement data for the currently signed-in player. Result will be returned through ACHIEVEMENT_LOAD_RESULT

Parameters

$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.

reveal()method 
public function reveal($achievementId:String, $immediate:Boolean):void

Reveals a hidden achievement to the currently signed-in player. If the achievement has already been unlocked, this will have no effect.

Parameters

$achievementId:String — The achievement ID to reveal.
 
$immediate:Boolean — If true, it will attempt to update the user's achievement on the server immediately. The Task will complete successfully when the server has been updated. Result will be returned through ACHIEVEMENT_UPDATE_RESULT.

setSteps()method 
public function setSteps($achievementId:String, $numSteps:int, $immediate:Boolean):void

Sets an achievement to have at least the given number of steps completed. Calling this method while the achievement already has more steps than the provided value is a no-op. Once the achievement reaches the maximum number of steps, the achievement will automatically be unlocked, and any further mutation operations will be ignored.

Parameters

$achievementId:String — The ID of the achievement to modify.
 
$numSteps:int — The number of steps to set the achievement to. Must be greater than 0.
 
$immediate:Boolean — If true, it will attempt to update the user's achievement on the server immediately. The Boolean in a successful response indicates whether the achievement is now unlocked. Result will be returned through ACHIEVEMENT_UPDATE_RESULT.

showNativeWindow()method 
public function showNativeWindow():void

loads a native window to show the list of achievements for a game.

unlock()method 
public function unlock($achievementId:String, $immediate:Boolean):void

Unlocks an achievement for the currently signed in player. If the achievement is hidden this will reveal it to the player.

Parameters

$achievementId:String — The ID of the achievement to unlock.
 
$immediate:Boolean — If true, it will attempt to update the user's achievement on the server immediately. The Task will complete successfully when the server has been updated. Result will be returned through ACHIEVEMENT_UPDATE_RESULT.