Packagecom.myflashlab.air.extensions.gameCenter
Classpublic class Challenge
InheritanceChallenge Inheritance 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:



Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined 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
Property Detail
achievementproperty
achievement:Achievement  [read-only]

The achievement the player must complete. will be non-nil if the issuingPlayer created the challenge from Achievement.


Implementation
    public function get achievement():Achievement
completionDateproperty 
completionDate:Date  [read-only]

The date the challenge was completed. If the challenge is not complete, this value is nil.


Implementation
    public function get completionDate():Date
issueDateproperty 
issueDate:Date  [read-only]

The date the challenge was issued.


Implementation
    public function get issueDate():Date
issuingPlayerproperty 
issuingPlayer:Player  [read-only]

The Player object associated with the player who issued the challenge.


Implementation
    public function get issuingPlayer():Player
messageproperty 
message:String  [read-only]

A text message that describes the challenge.


Implementation
    public function get message():String
receivingPlayerproperty 
receivingPlayer:Player  [read-only]

The Player object associated with the player who received the challenge.


Implementation
    public function get receivingPlayer():Player
scoreproperty 
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.


Implementation
    public function get score():Score
stateproperty 
state:int  [read-only]

The current state of the challenge.


Implementation
    public function get state():int
Method Detail
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 have
     function($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.