Package | com.myflashlab.air.extensions.gameCenter |
Class | public class AchievementDescription |
Inheritance | AchievementDescription 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.
Property | Defined 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 |
Method | Defined 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 |
achievedDescription | property |
achievedDescription:String
[read-only] A localized description to be used after the local player has completed the achievement.
public function get achievedDescription():String
completeDefImgPath | property |
completeDefImgPath:String
[read-only] A common image for completed achievements.
public function get completeDefImgPath():String
groupIdentifier | property |
groupIdentifier:String
[read-only] The identifier for the group the achievement description is part of.
public function get groupIdentifier():String
identifier | property |
identifier:String
[read-only] A unique string used to identify the achievement.
public function get identifier():String
incompleteDefImgPath | property |
incompleteDefImgPath:String
[read-only] A common image for incomplete achievements.
public function get incompleteDefImgPath():String
isHidden | property |
isHidden:Boolean
[read-only] A Boolean value that states whether this achievement is initially visible to players.
public function get isHidden():Boolean
isReplayable | property |
isReplayable:Boolean
[read-only] A Boolean value that states whether this achievement can be earned multiple times.
public function get isReplayable():Boolean
maximumPoints | property |
maximumPoints:int
[read-only] The number of points the player earns by completing this achievement.
public function get maximumPoints():int
title | property |
title:String
[read-only] A localized title for the achievement.
public function get title():String
unachievedDescription | property |
unachievedDescription:String
[read-only] A localized description of the achievement to be used when the local player has not completed the achievement.
public function get unachievedDescription():String
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.
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 havefunction($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.
|