00:00
00:00
Newgrounds Background Image Theme

Kiler91 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Browse Sections

Newgrounds Wiki: connect

Usage

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.


This command connects yo the API gateway and retrieves your settings. This call will fire an API_CONNECTED event.

Depending on what tools you have opted to use, this may also trigger the following events:

The following example demonstrates how to connect to the API with debug mode enabled

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);