How to Use - GameDistribution/GD-iOS-AIR GitHub Wiki
Initialize GdAPI
/* jSON Params
gid: Your game id
userid: Your user id
root: Root to detect the page
this initialization also shows an interstitial ad if preroll is enabled on your profile.
*/
GdAPI = new GDLogger({gid:"XXXXXXXXXXXXXXXXXX",userid : "XXXXXXXXXXXXXXXXXX", root : root});
GdAPI.EnabledDebug = true; // enables you to see log messages
/*
BlockText: The message which will be shown where sites you blocked. You can specify your own site adress.
*/
GdAPI.BlockText = "Please visit our site www.gamedistribution.com";
/*
Listen events
BANNER_RECEIVED, BANNER_STARTED, BANNER_CLOSED
yourFunction: The function you created which will handle when the event is fired
*/
GdAPI.addEventListener(GDEvent.BANNER_CLOSED,yourFunction1);
GdAPI.addEventListener(GDEvent.BANNER_STARTED,yourFunction2);
GdAPI.addEventListener(GDEvent.BANNER_RECEIVED,yourFunction3);
Show Banner
There are two types ads which the developer can request for: Interstitial and banner ads.
/*
This function takes json params.
_type: "insterstitial" or "banner"
_aligntment: "left", "center" or "right" of the screen * for banner ad
_position: "top", "middle" or "bottom" of the screen * for banner ad
_size: "banner", "large_banner", "medium_rectangle", "full_banner" or "leaderboard"
*/
GdAPI.ShowBanner({_key:"Level1",_type:"interstitial"}); // request interstitial
GdAPI.ShowBanner({_key:"Level1",_type:"banner", _alignment:"center",_position:"bottom", _size:"banner"}); // request banner
Banner Sizes
Banner Alignment and Position
Methods
/**
* Logger initializes the API. You must create GDApi first before doing anything else.
* It is a singleton class.
* @param gID Your game id from GameDistribution
* @param guid Your game guid from GameDistribution
* @param root Should be root to detect the page
*/
GDLogger({gid:gID,userid : guid, root : DisplayObject});
/**
* API sends how many times 'Play Button' is clicked. If you invoke 'PlayGame' many times,
* it increases 'PlayGame' counter and sends this counter value.
*/
PlayGame();
/**
* API sends how many times 'CustomLog' that is called related to given by _key name.
* If you invoke 'CustomLog' many times, it increases 'CustomLog' counter and
* sends this counter value.
*/
* @param _key Your custom key it should be maximum 10 chars
*/
CustomLog(_key:String);
/**
* API reshows banner. For example you need to show banner
* before starting a level, you can call ShowBanner({_key:"level1"}),
* if you need to show sample banner for ONLY test purpose,
* call ShowBanner({test:true})
*/
* @param _key It should be maximum 10 chars
*/
ShowBanner({_key:"keyword"});
/**
* It closes Banner
*/
CloseBanner();
/**
* Sets the API to use SSL-only for all communication
*/
SetSSL();