PlayerIO

The fastest way to build online games without breaking a sweat.

ActionScript3 Reference

actionscript 3 Achievements class informationClass Achievements

Namespace: playerio
Language: ActionScript 3

The Player.IO Achievements service

Properties

 
public
myAchievements :Array [read-only]

The list of all achievements; the values of Progress and ProgressGoal will indicate whether the achievement is started/pending/complete.

public
onCompletedHandler :Function [write-only]

Set a handler that is called when an achievement is completed.

Methods

 
public
get (achievementId:String):playerio:Achievement

This method gets the specified achievement

public
load (userIds:Array, callback:Function = null, errorHandler:Function = null):void

Load achivements for the specified users.

public
progressAdd (achievementId:String, progressDelta:int, callback:Function, errorHandler:Function):void

Add or subtract from the current progress of an achievement.

public
progressComplete (achievementId:String, callback:Function, errorHandler:Function):void

Complete the specified achievement, by setting the progress to the maximum (ProgressGoal) of the achievement.

public
progressMax (achievementId:String, progress:int, callback:Function, errorHandler:Function):void

Sets the current progress value to the bigger value of progress or the current value, i.e; newProgress = Max(currentProgress,progress)

public
progressSet (achievementId:String, progress:int, callback:Function, errorHandler:Function):void

Sets the progress of the specified achievement.

public
refresh (callback:Function = null, errorHandler:Function = null):void

Refresh myAchievements

Achievements.myAchievements

public
myAchievements :Array [read-only]

The list of all achievements; the values of Progress and ProgressGoal will indicate whether the achievement is started/pending/complete.

Achievements.onCompletedHandler

public
onCompletedHandler :Function [write-only]

Set a handler that is called when an achievement is completed.

Achievements.get

public
get (achievementId:String):playerio:Achievement

This method gets the specified achievement

Arguments

achievementId:String
The id of the achievement to get

Achievements.load

public
load (userIds:Array, callback:Function = null, errorHandler:Function = null):void

Load achivements for the specified users.

Arguments

userIds:Array
Array of userIds to load achivements for.
callback:Function (Default = null)
Callback that will be called with a dictionary where the keys are userIds and the values are their achievments.
errorHandler:Function (Default = null)
Callback that will be called instead of successCallback if an error occurs.

Achievements.progressAdd

public
progressAdd (achievementId:String, progressDelta:int, callback:Function, errorHandler:Function):void

Add or subtract from the current progress of an achievement.

Arguments

achievementId:String
The id of the achivement to add progress to.
progressDelta:int
The delta value that will be added to the current progress of the achievement.
callback:Function
Callback that will be called with the updated Achievement.
errorHandler:Function
Callback that will be called if an error occurs.

Achievements.progressComplete

public
progressComplete (achievementId:String, callback:Function, errorHandler:Function):void

Complete the specified achievement, by setting the progress to the maximum (ProgressGoal) of the achievement.

Arguments

achievementId:String
The id of the achivement to complete.
callback:Function
Callback that will be called with the updated Achievement.
errorHandler:Function
Callback that will be called if an error occurs.

Achievements.progressMax

public
progressMax (achievementId:String, progress:int, callback:Function, errorHandler:Function):void

Sets the current progress value to the bigger value of progress or the current value, i.e; newProgress = Max(currentProgress,progress)

Arguments

achievementId:String
The id of the achivement to work on.
progress:int
The possible new progress value that should be compared to the current progress value
callback:Function
Callback that will be called with the updated Achievement.
errorHandler:Function
Callback that will be called if an error occurs.

Achievements.progressSet

public
progressSet (achievementId:String, progress:int, callback:Function, errorHandler:Function):void

Sets the progress of the specified achievement.

Arguments

achievementId:String
The id of the achivement to add progress to.
progress:int
The new progress value for the achievement.
callback:Function
Callback that will be called with the updated Achievement.
errorHandler:Function

Achievements.refresh

public
refresh (callback:Function = null, errorHandler:Function = null):void

Refresh myAchievements

Arguments

callback:Function (Default = null)
Callback that will be called when the refresh is complete.
errorHandler:Function (Default = null)
Callback that will be called instead if an error occurs.