Page Contents
import com.newgrounds.API; API.connectMovie(api_id:String, encryption_key:String, debug_mode:Boolean);
- api_id - Your API entry's ID.
- encryption_key - Your API entry's encryption key.
- debug_mode - If true (recommended), the API will run in debug mode when running locally and on preview pages.
- API_CONNECTED
- ADS_APPROVED - Your game or movie was approved to run ads.
- HOST_BLOCKED - The site hosting the swf does not have permission.
- METADATA_LOADED - Medals, Scoreboards and Save Groups are loaded.
- NEW_VERSION_AVAILABLE - The swf is out of date Example
- Actionscript 3.0
import com.newgrounds.API;
import com.newgrounds.APIEvent;
function onAPIConnected(event:ApiEvent):void {
if (event.success) {
trace("You have connected to the API");
} else {
trace("The connection has failed");
}
}
API.addEventListener(APIEvent.API_CONNECTED, onAPIConnected);
API.connectMovie(<api_id>, <encryption_key>, true);
- Actionscript 2.0
import com.newgrounds.API;
import com.newgrounds.APIEvent;
function onAPIConnected(event:ApiEvent) {
if (event.success) {
trace("You have connected to the API");
} else {
trace("The connection has failed");
}
}
API.addEventListener(APIEvent.API_CONNECTED, onAPIConnected, true);
API.connectMovie(<api_id>, <encryption_key>, true);

