SolidGamesAPI Developer Zone
· Where can I get the API?
· How do I import the class?
· How do I configure the API?
· Where do I find my Game Key and Board Key?
· How do I submit a score?
· How do I show the score window?

Where can I get the API?

You can download the SolidGamesAPI here: SolidGamesAPI.zip

How do I import the API?

Add the API to your classpath by adding the SWC to your library.

Flash Develop: Right-Click > Add to Library
Adobe Flash: Publish Settings > Actionscript 3.0 Settings > Library Path > Browse to SWC File

Once in your classpath, you can import it like any other class:
import com.solidgames.SolidGamesAPI;

How do I configure the API?

To configure the SolidGamesAPI for use in your game, just pass the Game Key and Board Key into the static config method, along with a container for the API to load into, and an optional callback function.
SolidGamesAPI.config(container_:DisplayObjectContainer, gameKey_:String, boardKey_:String, onClose_:Function = null):void It is important to do this before you try to submit a score, preferably at the start of your game.

Example

// for attaching directly to the stage
SolidGamesAPI.config(stage, "my-awesome-game", "da1e100dc9e7bebb810985e37875de38", myCloseFunction);

// if you don't want to use a callback
SolidGamesAPI.config(stage, "my-awesome-game", "da1e100dc9e7bebb810985e37875de38");
For enhanced security we recommend that you use the following code to hide your Board Key in an Object.

Example

// for attaching directly to the stage
var o:Object = {k: [0xd, 0xa, 1, 0xe, 1, 0, 0, 0xd, 0xc, 9, 0xe, 7, 0xb, 0xe, 0xb, 0xb, 8, 1, 0, 9, 8, 5, 0xe, 3, 7, 8, 7, 5, 0xd, 0xe, 3, 8], f: function (i:int, s:String):String { if(s.length == 32) return s; return this.f(i + 1, s + this.k[i].toString(16));}};
var boardKey:String = o.f(0, "");
SolidGamesAPI.config(stage, "my-awesome-game", boardKey, myCloseFunction);

// if you don't want to use a callback
var o:Object = {k: [0xd, 0xa, 1, 0xe, 1, 0, 0, 0xd, 0xc, 9, 0xe, 7, 0xb, 0xe, 0xb, 0xb, 8, 1, 0, 9, 8, 5, 0xe, 3, 7, 8, 7, 5, 0xd, 0xe, 3, 8], f: function (i:int, s:String):String { if(s.length == 32) return s; return this.f(i + 1, s + this.k[i].toString(16));}};
var boardKey:String = o.f(0, "");
SolidGamesAPI.config(stage, "my-awesome-game", boardKey);

Where do I find my Game Key and Board Key?

Your sponsor contact should have provided you with your Game Key and Board Key. If you are unable to find either, please contact your sponsor contact and request them.

Your Game Key is usually the name of your game, lowercase, with hyphens instead of spaces and underscores.

Example

Game Name: My Awesome Game
Game Key: my-awesome-game

Your Board Key will be a 32-character string of letters and numbers.

Example

Board Key: da1e100dc9e7bebb810985e37875de38

How do I submit a score?

Once everything is configured properly, you are ready to submit a score to the server. To do this, simply pass your score variable into the static submitScore method.
SolidGamesAPI.submitScore(score_:Number, name_:String = null, pages_:int = 1):void Example

// somewhere in your game over logic
SolidGamesAPI.submitScore(finalScore);

You can also send the name automatically, without using the name input prompt. This is useful when the user has already specified their name elsewhere.

Example

// somewhere in your game over logic
SolidGamesAPI.submitScore(finalScore, playerName);

If you want more than 1 page of scores to display after the score is submitted, just pass the desired number into the same function.

Example

// somewhere in your game over logic
SolidGamesAPI.submitScore(finalScore, null, 4);

If you want to submit a score in the background without asking your user for any input and without showing the leaderboard, you need to pass the desired score, name and set pages_ = 0.

Example

// somewhere in your game over logic
SolidGamesAPI.submitScore(finalScore, playerName, 0);

How do I show the score window?

If you want to show the score window without first submitting a score, just use the appropriate method.
SolidGamesAPI.showScores(pages_:int = 1):void Example

// in the event handler for a button click
SolidGamesAPI.showScores();

If you want more than 1 page of scores to display, just pass the desired number into the same function.

Example

// in the event handler for a button click
SolidGamesAPI.showScores(5);