Kongregate has a Flash API that supports both Actionscript 2.0 and Actionscript 3.0.
Overview[]
ActionScript 2[]
Before you integrate the Kongregate API into your game, first, you must go to your game page and add /statistics after the URL. For example, if I had a game named "EsI", I would go to www.kongregate.com/games/EsIeX3/Esi/statistics. Here, you get the statistics editor, where you set the names and types. There's four types, which are:
- Max – The value on the server will be replaced if the new value is higher, for example a high score.
- Min – The value on the server will be replaced if the new value is lower, for example the lowest time for completing a lap.
- Add – The new value will be added to the value stored on the server, for example total number of coins collected. This can be used for statistics which are cumulative.
- Replace – The new value will always overwrite the value on the server, this can be useful for boolean flags such as “Found key in level 1”
Now that the values are set, in the Actionscript code, add this in the first frame:
_root.kongregateServices.connect();
Yes, you can do this later, but it's recommended to add it in the first frame so that the red button lights up to green above the chat box. Now that you've connected, you can send in statistics by putting in the following code
_root.kongregateStats.submit("YourStatistic",1);//1 being the number you want to send in with it
And that's it!
ActionScript 3[]
TODO