Package | com.myflashlab.air.extensions.gameCenter |
Class | public class Challenge |
Inheritance | Challenge flash.events.EventDispatcher |
An object representing a challenge issued by the local player to another player. Players use the Game Center app to issue and view challenges. However, your game can also customize its challenge behaviors in a number of ways:
Challenge.load
static method. For example, you might do this to display the challenges in your game’s user interface.Score
or Achievement
object. Your game should
only issue challenges when the local player initiates the action in your user interface.Property | Defined By | ||
---|---|---|---|
achievement : Achievement [read-only]
The achievement the player must complete. | Challenge | ||
completionDate : Date [read-only]
The date the challenge was completed. | Challenge | ||
issueDate : Date [read-only]
The date the challenge was issued. | Challenge | ||
issuingPlayer : Player [read-only]
The Player object associated with the player who issued the challenge. | Challenge | ||
message : String [read-only]
A text message that describes the challenge. | Challenge | ||
receivingPlayer : Player [read-only]
The Player object associated with the player who received the challenge. | Challenge | ||
score : Score [read-only]
The score to beat. | Challenge | ||
state : int [read-only]
The current state of the challenge. | Challenge |
Method | Defined By | ||
---|---|---|---|
decline():void
Declines a challenge.
If your game implements a custom user interface to display challenges, it should include controls that allow
a player to decline a challenge. | Challenge | ||
load($callback:Function):void [static]
Loads the list of outstanding challenges. | Challenge |
achievement | property |
achievement:Achievement
[read-only] The achievement the player must complete. will be non-nil if the issuingPlayer created the challenge from Achievement.
public function get achievement():Achievement
completionDate | property |
completionDate:Date
[read-only] The date the challenge was completed. If the challenge is not complete, this value is nil.
public function get completionDate():Date
issueDate | property |
issueDate:Date
[read-only] The date the challenge was issued.
public function get issueDate():Date
issuingPlayer | property |
issuingPlayer:Player
[read-only] The Player object associated with the player who issued the challenge.
public function get issuingPlayer():Player
message | property |
message:String
[read-only] A text message that describes the challenge.
public function get message():String
receivingPlayer | property |
receivingPlayer:Player
[read-only] The Player object associated with the player who received the challenge.
public function get receivingPlayer():Player
score | property |
score:Score
[read-only] The score to beat. will be non-nil if the issuingPlayer created the challenge from Score. To complete the challenge, the player must score an equal or better score than the score used to create the challenge. When a player beats a score challenge, a new score challenge is automatically issued to the player that issued the challenge unless there is already a pending score challenge that requires a better score.
public function get score():Score
state | property |
state:int
[read-only] The current state of the challenge.
public function get state():int
decline | () | method |
public function decline():void
Declines a challenge.
If your game implements a custom user interface to display challenges, it should include controls that allow a player to decline a challenge. If the player uses your user interface to decline a challenge, call this method.
load | () | method |
public static function load($callback:Function):void
Loads the list of outstanding challenges.
Below shows what parameters the callback function must havefunction($challenges:Vector.<Challenge>, $error:String):void { // $challenges: is an array of Challenge objects that represents all challenges made to the local player. If an error occurred, this parameter may be non-nil, in which case the array holds whatever challenge information Game Kit was able to fetch. // $error: If an error occurred, this object describes the error. If the operation completed successfully, this value is nil. }
Parameters
$callback:Function — will be called when the download is completed.
|