Packagecom.myflashlab.air.extensions.gameCenter
Classpublic class AchievementDescription
InheritanceAchievementDescription Inheritance flash.events.EventDispatcher

An object holding text and images used to describe an achievement for an app.

When you develop your game, you create localized achievement descriptions in App Store Connect. At runtime, your game retrieves these descriptions from Game Center. Usually your game downloads the achievement descriptions when it wants to present a custom achievement user interface to the player.

To retrieve a set of achievement description objects for your game, call the load static method. For performance reasons, achievement images are downloaded separately. To download am achievement description’s completion image, call that object’s loadImage method.



Public Properties
 PropertyDefined By
  achievedDescription : String
[read-only] A localized description to be used after the local player has completed the achievement.
AchievementDescription
  completeDefImgPath : String
[read-only] A common image for completed achievements.
AchievementDescription
  groupIdentifier : String
[read-only] The identifier for the group the achievement description is part of.
AchievementDescription
  identifier : String
[read-only] A unique string used to identify the achievement.
AchievementDescription
  incompleteDefImgPath : String
[read-only] A common image for incomplete achievements.
AchievementDescription
  isHidden : Boolean
[read-only] A Boolean value that states whether this achievement is initially visible to players.
AchievementDescription
  isReplayable : Boolean
[read-only] A Boolean value that states whether this achievement can be earned multiple times.
AchievementDescription
  maximumPoints : int
[read-only] The number of points the player earns by completing this achievement.
AchievementDescription
  title : String
[read-only] A localized title for the achievement.
AchievementDescription
  unachievedDescription : String
[read-only] A localized description of the achievement to be used when the local player has not completed the achievement.
AchievementDescription
Public Methods
 MethodDefined By
  
load($callback:Function):void
[static] Downloads the achievement descriptions from Game Center.
AchievementDescription
  
loadImage($callback:Function):void
Loads the image property for a completed achievement.
AchievementDescription
Property Detail
achievedDescriptionproperty
achievedDescription:String  [read-only]

A localized description to be used after the local player has completed the achievement.


Implementation
    public function get achievedDescription():String
completeDefImgPathproperty 
completeDefImgPath:String  [read-only]

A common image for completed achievements.


Implementation
    public function get completeDefImgPath():String
groupIdentifierproperty 
groupIdentifier:String  [read-only]

The identifier for the group the achievement description is part of.


Implementation
    public function get groupIdentifier():String
identifierproperty 
identifier:String  [read-only]

A unique string used to identify the achievement.


Implementation
    public function get identifier():String
incompleteDefImgPathproperty 
incompleteDefImgPath:String  [read-only]

A common image for incomplete achievements.


Implementation
    public function get incompleteDefImgPath():String
isHiddenproperty 
isHidden:Boolean  [read-only]

A Boolean value that states whether this achievement is initially visible to players.


Implementation
    public function get isHidden():Boolean
isReplayableproperty 
isReplayable:Boolean  [read-only]

A Boolean value that states whether this achievement can be earned multiple times.


Implementation
    public function get isReplayable():Boolean
maximumPointsproperty 
maximumPoints:int  [read-only]

The number of points the player earns by completing this achievement.


Implementation
    public function get maximumPoints():int
titleproperty 
title:String  [read-only]

A localized title for the achievement.


Implementation
    public function get title():String
unachievedDescriptionproperty 
unachievedDescription:String  [read-only]

A localized description of the achievement to be used when the local player has not completed the achievement.


Implementation
    public function get unachievedDescription():String
Method Detail
load()method
public static function load($callback:Function):void

Downloads the achievement descriptions from Game Center. Loading and displaying achievements using a custom interface is a two-step process, with the first step being to call the load method. Calling this method loads all of the achievement descriptions for your game. The second step is to load an image only when it is required. See loadImage for more details.

Below shows what parameters the callback function must have
     function($descriptions:Vector.<AchievementDescription>, $error:String):void
     {
         // $descriptions: is an array of AchievementDescription objects containing the achievements in your game.
         // $error: If an error occurred, this value may be non-nil. In this case, the array holds whatever descriptions were downloaded by Game Kit before the error occurred.
     }
     

Parameters

$callback:Function

loadImage()method 
public function loadImage($callback:Function):void

Loads the image property for a completed achievement. Your game should display the placeholder image until the image is successfully downloaded.

Below shows what parameters the callback function must have
     function($achievementDescription:AchievementDescription, $image:String, $error:String):void
     {
         // $achievementDescription: is a reference to the object which initiated this method.
         // $image: is the downloaded image. If an error occurred, this value is nil.
         // $error: If an error occurred, this error object describes the error. If the operation completed successfully, this value is nil.
     }
     

Parameters

$callback:Function — will be called when the download is completed.