Be a Supporter!

Browse Sections

Newgrounds Wiki: setVersion

Page Contents


import com.newgrounds.API;
  • version - A string in the format "X.X.X" indicating the version of your current build.

This method is used to tell the API what version of your game or movie you are compiling.

If this version appears older than the version you have in your API settings page, the API will fire a NEW_VERSION_AVAILABLE event.


The following example demonstrates how you can set your version and inform a user of the version they are playing is out-of-date.
import com.newgrounds.API;
import com.newgrounds.APIEvent;

var this_version:String = "1.0.1"; API.setVersion(this_version);

function onNewVersion(event:APIEvent) { var url:String = event.url; var version:String = event.version; trace("Version "+version+" is avaliable at: "+url); }

API.addEventListener(APIEvent.NEW_VERSION_AVAILABLE, onNewVersion);