ActionScript 2 API

🚧

Deprecated

The AS2 API is no longer being actively developed, and is no longer fully supported

Kongregate's ActionScript 2 API

The Kongregate ActionScript 2 (AS2) API allows you to extend your game to communicate with the Kongregate back-end. The API is automatically loaded for all ActionScript 2 games, so there is nothing to download or install in order to integrate.

Accessing the API and Connecting

In order to access the Kongregate API object, you can simply get a reference to it from the _global space. It is good practice to call the connect method as soon as possible, as shown in the code below:

var kongregate = _global.kongregate;
kongregate.services.connect();

The Kongregate API Object

As you can see in the code above, we keep a reference to the "Kongregate API" object and store it in the variable named kongregate. This is the assumption that is made for the remainder of the documentation, so if you store this reference in a different way, make sure to modify the examples accordingly. For ActionScript 2, you can always just use the _global reference, and substitute in _global.kongregate wherever you see the kongregate variable in the sample code.

Once the API is loaded, you can start using functions from the Client API in your application.