PackageAndrograde
Interfacepublic interface API
ImplementorsAPIClient

The abstract base class for the API, use APIClient instead

See also

APIClient


Public Properties
 PropertyDefined by
  debugDisplay : TextField
[read-only] Gets a display object that shows the Andrograde API log for non debug build testing
API
  game : String
[read-only] returns the game code for this game
API
  ip : String
[read-only] returns the IP of the user playing the game
API
  live : Boolean
[read-only] returns whether the game is live or not
API
  parameters_server : Object
[read-only] Returns all of the server variables for the game as an Object with all the parameters as member variables (like URLVariables)
API
  parameters_url : Object
[read-only] Returns all of the url parameters to the swf as an Object with all the parameters as member variables (like URLVariables)
API
  plays : uint
[read-only] Returns how many global plays this game has had
API
  points_per_dollar : uint
[read-only] returns how many Andrograde points there is in a dollar
API
  title : String
[read-only] Returns the title of the game
API
  UI : UI
[read-only] return the Andrograde UI object so you can draw all sorts of cool stuff
API
  user : User
[read-only] Gets the current user if there is one logged in, null if not logged in
API
  valid : Boolean
[read-only] returns whether this is a valid Andrograde Session
API
Public Methods
 MethodDefined by
  
buy(cost:uint, item:String, image:DisplayObject = null, callback:Function = null, container:DisplayObjectContainer = null, x:int = -1, y:int = -1):void
Shows a dialog allowing the user to buy a game item calls 'callback(success:Boolean):void' when it's done
API
  
buypoints(callback:Function = null, container:DisplayObjectContainer = null, x:int = -1, y:int = -1):void
Shows a dialog allowing the user to buy/get andrograde points calls 'callback():void' when it's done
API
  
getHighScores(stat:String, type:uint, startingOffset:uint, howMany:uint, callback:Function):void
Fetches a list of highscores of a certain stat from the server calls 'callback(highscores:Array):void' when it's done where result is a 2d array of name/value pairs
API
  
getIdentity(name:String, callback:Function):void
Resolves a name to all matching identities in the system calls 'callback(identities:Array):void' (identities=null if failed)
API
  
getUserInfo(identity:String, callback:Function = null):void
gets the stats from the server for any user
calls 'callback(user:User):void' user= null if failed
API
  
login(callback:Function = null, container:DisplayObjectContainer = null, x:int = -1, y:int = -1):void
Shows a dialog allowing a user to login to their Andrograde account calls 'callback(success:Boolean):void' when it's done
API
  
logout(callback:Function = null):void
logs a user out calls 'callback(success:Boolean):void' when done
API
  
parameters_server_sync(callback:Function = null):void
synchronizes the server parameters with the server
API
Property detail
debugDisplayproperty
debugDisplay:TextField  [read-only]

Gets a display object that shows the Andrograde API log for non debug build testing

Implementation
    public function get debugDisplay():TextField

Example
addChild(API.debugDisplay);

gameproperty 
game:String  [read-only]

returns the game code for this game

Implementation
    public function get game():String
ipproperty 
ip:String  [read-only]

returns the IP of the user playing the game

Implementation
    public function get ip():String
liveproperty 
live:Boolean  [read-only]

returns whether the game is live or not

Implementation
    public function get live():Boolean
parameters_serverproperty 
parameters_server:Object  [read-only]

Returns all of the server variables for the game as an Object with all the parameters as member variables (like URLVariables)

Implementation
    public function get parameters_server():Object

Example
trace(parameters_server.bigCatcherPrice);

parameters_urlproperty 
parameters_url:Object  [read-only]

Returns all of the url parameters to the swf as an Object with all the parameters as member variables (like URLVariables)

Implementation
    public function get parameters_url():Object

Example
trace(parameters_url.someSWFparameter);

playsproperty 
plays:uint  [read-only]

Returns how many global plays this game has had

Implementation
    public function get plays():uint
points_per_dollarproperty 
points_per_dollar:uint  [read-only]

returns how many Andrograde points there is in a dollar

Implementation
    public function get points_per_dollar():uint
titleproperty 
title:String  [read-only]

Returns the title of the game

Implementation
    public function get title():String
UIproperty 
UI:UI  [read-only]

return the Andrograde UI object so you can draw all sorts of cool stuff

Implementation
    public function get UI():UI

See also

UI
userproperty 
user:User  [read-only]

Gets the current user if there is one logged in, null if not logged in

Implementation
    public function get user():User
validproperty 
valid:Boolean  [read-only]

returns whether this is a valid Andrograde Session

Implementation
    public function get valid():Boolean
Method detail
buy()method
public function buy(cost:uint, item:String, image:DisplayObject = null, callback:Function = null, container:DisplayObjectContainer = null, x:int = -1, y:int = -1):void

Shows a dialog allowing the user to buy a game item calls 'callback(success:Boolean):void' when it's done

Parameters
cost:uint — the x position to place the window at (defaults to the middle of the stage)
 
item:String — the y position to place the window at (defaults to the middle of the stage)
 
image:DisplayObject (default = null) — how many Andrograde points it costs
 
callback:Function (default = null) — the name of the item
 
container:DisplayObjectContainer (default = null)
 
x:int (default = -1)
 
y:int (default = -1)
buypoints()method 
public function buypoints(callback:Function = null, container:DisplayObjectContainer = null, x:int = -1, y:int = -1):void

Shows a dialog allowing the user to buy/get andrograde points calls 'callback():void' when it's done

Parameters
callback:Function (default = null) — the x position to place the window at (defaults to the middle of the stage)
 
container:DisplayObjectContainer (default = null) — the y position to place the window at (defaults to the middle of the stage)
 
x:int (default = -1)
 
y:int (default = -1)
getHighScores()method 
public function getHighScores(stat:String, type:uint, startingOffset:uint, howMany:uint, callback:Function):void

Fetches a list of highscores of a certain stat from the server calls 'callback(highscores:Array):void' when it's done where result is a 2d array of name/value pairs

Parameters
stat:String — which stat to receive the list for
 
type:uint — either HIGHSCORE_HIGHEST or HIGHSCORE_LOWEST
 
startingOffset:uint — the starting offset to start getting scores from
 
howMany:uint — how many scores to get (this must be <= 100)
 
callback:Function

See also


Example
To read the results:

highscores[i][0] is the identity

highscores[i][1] is the name

highscores[i][2] is the stat value for that identity

getIdentity()method 
public function getIdentity(name:String, callback:Function):void

Resolves a name to all matching identities in the system calls 'callback(identities:Array):void' (identities=null if failed)

Parameters
name:String — the name of the person who you want the identity matches of
 
callback:Function
getUserInfo()method 
public function getUserInfo(identity:String, callback:Function = null):void

gets the stats from the server for any user
calls 'callback(user:User):void' user= null if failed

Parameters
identity:String — the user's identity (user.identity)
 
callback:Function (default = null)

See also

login()method 
public function login(callback:Function = null, container:DisplayObjectContainer = null, x:int = -1, y:int = -1):void

Shows a dialog allowing a user to login to their Andrograde account calls 'callback(success:Boolean):void' when it's done

Parameters
callback:Function (default = null) — the x position to place the login window at (defaults to the middle of the stage)
 
container:DisplayObjectContainer (default = null) — the y position to place the login window at (defaults to the middle of the stage)
 
x:int (default = -1) — what function to call when the login succeeds/fails
 
y:int (default = -1)
logout()method 
public function logout(callback:Function = null):void

logs a user out calls 'callback(success:Boolean):void' when done

Parameters
callback:Function (default = null)
parameters_server_sync()method 
public function parameters_server_sync(callback:Function = null):void

synchronizes the server parameters with the server

Parameters
callback:Function (default = null)