Packagecom.distriqt.extension.gameservices.achievements
Interfacepublic interface Achievements extends flash.events.IEventDispatcher

Achievements

This interface defines the achievements functionality for the Game Services native extension.

All the functionality here can be accessed through the main GameServices class as below:

     GameServices.service.achievements.[FUNCTION]
     

See also

com.distriqt.extension.gameservices.GameServices.achievements


Public Properties
 PropertyDefined By
  canResetAchievements : Boolean
[read-only] Returns true if the current service provides the ability to reset achievement status.
Achievements
  isSupported : Boolean
[read-only] Returns true if the achievements functionality is supported on the current game service
Achievements
Public Methods
 MethodDefined By
  
achievementReveal(achievementId:String):void
Reveals a hidden achievement.
Achievements
  
achievementStepsIncrement(achievementId:String, numSteps:int):void
Increments an achievement by the given number of steps.
Achievements
  
achievementStepsSet(achievementId:String, numSteps:int):void
Set an achievement to have at least the given number of steps completed.
Achievements
  
achievementUnlock(achievementId:String):void
Unlock an achievement.
Achievements
  
Displays a native UI showing the current user's achievements.
Achievements
  
loadAchievements(forceReload:Boolean = false):void
Loads all achievements available for this game and are returned in a AchievementEvent.ACHIEVEMENTS_LOADED.
Achievements
  
Calling this class method deletes all progress towards achievements previously reported for the local player.
Achievements
Events
 Event Summary Defined By
   Dispatched when there was an error loading the achievements.Achievements
   Dispatched when the achievements have been loaded after a call to loadAchievements data will contain an array of the Achievement objects retrieved from the service.Achievements
   Dispatched if the user's achievements have been reset Achievements
   Dispatched if there was an error resetting the user's achievements Achievements
   Dispatched when the player closes the achievements native UI.Achievements
Property Detail
canResetAchievementsproperty
canResetAchievements:Boolean  [read-only]

Returns true if the current service provides the ability to reset achievement status. If this returns false calling resetAchievements() will do nothing.


Implementation
    public function get canResetAchievements():Boolean
isSupportedproperty 
isSupported:Boolean  [read-only]

Returns true if the achievements functionality is supported on the current game service


Implementation
    public function get isSupported():Boolean
Method Detail
achievementReveal()method
public function achievementReveal(achievementId:String):void

Reveals a hidden achievement. Revealing means that the achievement will now be shown to the player, once revealed an achievement cannot be hidden again.

If the achievement has already been revealed, this will have no effect.

Parameters

achievementId:String — The ID of the achievement to reveal

achievementStepsIncrement()method 
public function achievementStepsIncrement(achievementId:String, numSteps:int):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.

This is only applicable to incremental achievements.

Parameters

achievementId:String — The ID of the incremental achievement
 
numSteps:int — The number of steps to increment by. Must be greater than 0.

achievementStepsSet()method 
public function achievementStepsSet(achievementId:String, numSteps:int):void

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

This is only applicable to incremental achievements.

Parameters

achievementId:String — The ID of the incremental achievement
 
numSteps:int — The number of steps to set the achievement to. Must be greater than 0.

achievementUnlock()method 
public function achievementUnlock(achievementId:String):void

Unlock an achievement. Unlocking means that the player has satisfied the requirements for this achievement in the game. The player will be given any achievement points associated with this achievement.

If the achievement is hidden this will reveal it to the player.

Parameters

achievementId:String — The ID of the achievement to unlock

displayAchievementsUI()method 
public function displayAchievementsUI():void

Displays a native UI showing the current user's achievements.

loadAchievements()method 
public function loadAchievements(forceReload:Boolean = false):void

Loads all achievements available for this game and are returned in a AchievementEvent.ACHIEVEMENTS_LOADED.

Parameters

forceReload:Boolean (default = false) — If true the server is contacted for updated information otherwise the local cache is used.

See also

resetAchievements()method 
public function resetAchievements():void

Calling this class method deletes all progress towards achievements previously reported for the local player. Hidden achievements that were previously visible are now hidden again.


Example
The following shows an example of how to reset your game’s achievements.
         if (GameServices.service.achievements.canResetAchievements)
         {
             GameServices.service.achievements.resetAchievements();
                  }
         
Event Detail
achievements:error Event
Event Object Type: com.distriqt.extension.gameservices.events.AchievementEvent
AchievementEvent.type property = com.distriqt.extension.gameservices.events.AchievementEvent.ACHIEVEMENTS_ERROR

Dispatched when there was an error loading the achievements.

achievements:loaded Event  
Event Object Type: com.distriqt.extension.gameservices.events.AchievementEvent
AchievementEvent.type property = com.distriqt.extension.gameservices.events.AchievementEvent.ACHIEVEMENTS_LOADED

Dispatched when the achievements have been loaded after a call to loadAchievements

data will contain an array of the Achievement objects retrieved from the service.

achievements:reset:complete Event  
Event Object Type: com.distriqt.extension.gameservices.events.AchievementEvent
AchievementEvent.type property = com.distriqt.extension.gameservices.events.AchievementEvent.ACHIEVEMENTS_RESET_COMPLETE

Dispatched if the user's achievements have been reset

achievements:reset:error Event  
Event Object Type: com.distriqt.extension.gameservices.events.AchievementEvent
AchievementEvent.type property = com.distriqt.extension.gameservices.events.AchievementEvent.ACHIEVEMENTS_RESET_ERROR

Dispatched if there was an error resetting the user's achievements

achievements:ui:closed Event  
Event Object Type: com.distriqt.extension.gameservices.events.AchievementEvent
AchievementEvent.type property = com.distriqt.extension.gameservices.events.AchievementEvent.ACHIEVEMENTS_UI_CLOSED

Dispatched when the player closes the achievements native UI.