Combined Code
frame 1 {
NewgroundsAPI.connectMovie(7226);
}
movieClip 3 {
}
movieClip 7 {
}
movieClip 17 {
frame 40 {
stop();
}
}
movieClip 30 {
}
button 31 {
on (press) {
tellTarget ('_root') {
nextFrame();
}
}
}
button 32 {
on (press) {
gotoAndStop('end');
_root.play();
}
}
movieClip 33 {
instance of movieClip 7 {
onClipEvent (load) {
_root.stop();
PercentLoaded = int((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (PercentLoaded != 100) {
_parent.gotoAndStop(PercentLoaded);
} else {
_parent.gotoAndStop('lastframe');
}
}
onClipEvent (enterFrame) {
PercentLoaded = int((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (PercentLoaded != 100) {
_parent.gotoAndStop(PercentLoaded);
} else {
_parent.gotoAndPlay('loaded');
}
}
}
frame 101 {
play();
}
frame 165 {
stop();
}
}
button 39 {
on (release) {
NewgroundsAPI.loadNewgrounds();
}
}
button 45 {
on (release) {
NewgroundsAPI.loadNewgrounds();
}
}
movieClip 46 {
}
movieClip 47 {
frame 1 {
function startAd(ngad_url) {
trace('opening ' + ngad_url);
System.security.allowDomain('70.87.128.99');
System.security.allowInsecureDomain('70.87.128.99');
System.security.allowDomain('ads.shizmoo.com');
System.security.allowInsecureDomain('ads.shizmoo.com');
System.security.allowDomain('www.cpmstar.com');
System.security.allowInsecureDomain('www.cpmstar.com');
System.security.allowDomain('server.cpmstar.com');
System.security.allowInsecureDomain('server.cpmstar.com');
var ngads_redirect = new XML();
ngads_redirect.ignoreWhite = true;
ngads_redirect.onLoad = function (success) {
trace('[NEWGROUNDS FLASH ADS] :: You may get a \'Security Sandbox Violation\' ... this is normal, do not freak out!');
if (success) {
ng_ad.loadMovie(ngads_redirect.toString(), 'GET');
} else {}
};
ngads_redirect.load(ngad_url);
}
if (NewgroundsAPI.getAdURL()) {
startAd(NewgroundsAPI.getAdURL());
}
NewgroundsAPI.onAdsApproved = function (ad_url) {
startAd(ad_url);
};
stop();
}
}
movieClip 49 __Packages.NewgroundsAPI {
#initclip
if (!_global.NewgroundsAPI) {
var v1 = function () {};
_global.NewgroundsAPI = v1;
var v2 = v1.prototype;
v1.connectMovie = function (id) {
if (!id) {
NewgroundsAPI.SendError('Missing required \'id\' parameter in NewgroundsAPI.connectMovie(id:Number)');
} else {
if (!NewgroundsAPI.tracker_id) {
NewgroundsAPI.SendMessage('Connecting to API gateway...');
NewgroundsAPI.tracker_id = id;
NewgroundsAPI.host = (_url.split('/'))[2].toLowerCase();
if (NewgroundsAPI.host.length < 1) {
NewgroundsAPI.host = 'localhost';
}
var v2 = new Object();
NewgroundsAPI.SendEvent(NewgroundsAPI.MOVIE_VIEWS);
}
}
};
v1.setMovieVersion = function (movie_version) {
if (!movie_version) {
NewgroundsAPI.SendError('Missing required \'version\' in NewgroundsAPI.setMovieVersion(version:String)');
} else {
NewgroundsAPI.version = movie_version;
}
};
v1.debugMode = function () {
NewgroundsAPI.debug = true;
};
v1.addCustomEvent = function (stat_id, stat_name) {
if (!stat_id) {
NewgroundsAPI.SendError('Missing required \'id\' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)');
} else {
if (!stat_name) {
NewgroundsAPI.SendError('Missing required \'event_name\' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)');
} else {
NewgroundsAPI.custom_events[stat_name] = NewgroundsAPI.CUSTOM_STATS + stat_id;
NewgroundsAPI.SendMessage('Created custom event: ' + stat_name);
}
}
};
v1.addCustomLink = function (stat_id, stat_name) {
if (!stat_id) {
NewgroundsAPI.SendError('Missing required \'id\' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)');
} else {
if (!stat_name) {
NewgroundsAPI.SendError('Missing required \'link_name\' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)');
} else {
NewgroundsAPI.custom_links[stat_name] = NewgroundsAPI.CUSTOM_STATS + stat_id;
NewgroundsAPI.SendMessage('Created custom link ' + stat_id + ': ' + stat_name);
}
}
};
v1.loadMySite = function () {
NewgroundsAPI.SendLink(NewgroundsAPI.AUTHOR_SITE);
};
v1.loadNewgrounds = function (special) {
if (special) {
var v1 = {'page': special};
}
NewgroundsAPI.SendLink(NewgroundsAPI.NEWGROUNDS, v1);
};
v1.logCustomEvent = function (event_name) {
if (!event_name) {
NewgroundsAPI.SendError('Missing required \'event_name\' parameter in NewgroundsAPI.logCustomEvent(event_name:String)');
} else {
if (!NewgroundsAPI.custom_events[event_name]) {
NewgroundsAPI.SendError('Attempted to log undefined custom event: ' + event_name);
} else {
NewgroundsAPI.SendEvent(NewgroundsAPI.custom_events[event_name]);
}
}
};
v1.loadCustomLink = function (link_name) {
if (!link_name) {
NewgroundsAPI.SendError('Missing required \'link_name\' parameter in NewgroundsAPI.loadCustomLink(link_name:String)');
} else {
if (!NewgroundsAPI.custom_links[link_name]) {
NewgroundsAPI.SendError('Attempted to open undefined custom link: ' + link_name);
} else {
NewgroundsAPI.SendLink(NewgroundsAPI.custom_links[link_name]);
}
}
};
v1.getAdURL = function () {
return NewgroundsAPI.movie_options.ad_url;
};
v1.getMovieURL = function () {
if (NewgroundsAPI.movie_options.movie_url) {
return NewgroundsAPI.movie_options.movie_url;
} else {
return 'Newgrounds.com';
}
};
v1.getNewVersionURL = function () {
return NewgroundsAPI.GATEWAY_URL + '?&id=' + NewgroundsAPI.tracker_id + '&host=' + escape(NewgroundsAPI.host) + '&stat=' + NewgroundsAPI.NEW_VERSION;
};
v1.SendEvent = function (id) {
NewgroundsAPI.SendStat(id, false);
};
v1.SendLink = function (id, extra) {
NewgroundsAPI.SendStat(id, true, extra);
};
v1.ReadGatewayData = function (params) {
for (var v2 in params) {
params[v2] = unescape(params[v2]);
NewgroundsAPI.movie_options[v2] = params[v2];
}
if (params.settings_loaded) {
NewgroundsAPI.SendMessage('You have successfully connected to the Newgrounds API gateway!');
NewgroundsAPI.SendMessage('Movie Identified as \'' + NewgroundsAPI.movie_options.movie_name + '\'');
if (NewgroundsAPI.movie_options.message) {
NewgroundsAPI.SendMessage(NewgroundsAPI.movie_options.message);
}
if (NewgroundsAPI.movie_options.ad_url) {
NewgroundsAPI.SendMessage('Your movie has been approved to run Flash Ads');
NewgroundsAPI.onAdsApproved(NewgroundsAPI.movie_options.ad_url);
}
if (NewgroundsAPI.movie_options.movie_version and NewgroundsAPI.movie_options.movie_version.toString() != NewgroundsAPI.version.toString()) {
NewgroundsAPI.SendMessage('WARNING: The movie version configured in your API settings does not match this movie\'s version!');
NewgroundsAPI.onNewVersionAvailable(NewgroundsAPI.movie_options.movie_version, NewgroundsAPI.getMovieURL(), NewgroundsAPI.getNewVersionURL());
}
if (NewgroundsAPI.movie_options.deny_host) {
NewgroundsAPI.SendMessage('You have blocked \'localHost\' in your API settings.');
NewgroundsAPI.SendMessage('If you wish to test your movie you will need to remove this block.');
NewgroundsAPI.onDenyHost(NewgroundsAPI.host, NewgroundsAPI.getMovieURL(), NewgroundsAPI.getNewVersionURL());
}
if (NewgroundsAPI.movie_options.request_portal_url == 1) {
var v4 = NewgroundsAPI.GATEWAY_URL + '?&id=' + NewgroundsAPI.tracker_id + '&portal_url=' + escape(_url);
var v3 = new XML();
v3.ignoreWhite = true;
v3.load(v4);
}
} else {
if (!NewgroundsAPI.movie_options.settings_loaded) {
NewgroundsAPI.SendError('Could not establish connection to the API gateway.');
}
}
};
v1.SendStat = function (stat_id, open_in_browser, extra) {
if (!NewgroundsAPI.tracker_id) {
NewgroundsAPI.SendError('API calls cannot be made without a valid movie id.');
NewgroundsAPI.SendError('Did you remember to add the "NewgroundsAPI.connectMovie()" code?');
} else {
var v7 = NewgroundsAPI.GATEWAY_URL + '?&id=' + NewgroundsAPI.tracker_id + '&host=' + escape(NewgroundsAPI.host) + '&stat=' + stat_id;
for (var v9 in extra) {
v7 += '&' + escape(v9) + '=' + escape(extra[v9]);
}
trace(v7);
if (NewgroundsAPI.debug) {
v7 += '&debug=1';
}
if (open_in_browser) {
getURL(v7, '_blank');
} else {
var v10 = new XML();
v10.ignoreWhite = true;
v10.onLoad = function (success) {
var v6 = new Object();
var v3 = 0;
while (v3 < this.firstChild.childNodes.length) {
var v4 = this.firstChild.childNodes[v3];
var v5 = v4.nodeName;
var v2 = v4.attributes.value;
if (v2 == Number(v2)) {
v2 = Number(v2);
}
v6[v5] = v2;
++v3;
}
NewgroundsAPI.ReadGatewayData(v6);
};
v10.load(v7);
}
}
};
v1.SendError = function (msg) {
trace('[NEWGROUNDS API ERROR] :: ' + msg);
};
v1.SendMessage = function (msg) {
trace('[NEWGROUNDS API] :: ' + msg);
};
v1.InitTextFormats = function () {
if (!NewgroundsAPI.error_format) {
NewgroundsAPI.error_format = new TextFormat();
NewgroundsAPI.error_format.font = 'Arial Black';
NewgroundsAPI.error_format.size = 48;
NewgroundsAPI.error_format.color = 16711680;
}
if (!NewgroundsAPI.header_format) {
NewgroundsAPI.header_format = new TextFormat();
NewgroundsAPI.header_format.font = 'Arial Black';
NewgroundsAPI.header_format.size = 24;
NewgroundsAPI.header_format.color = 16777215;
}
if (!NewgroundsAPI.normal_format) {
NewgroundsAPI.normal_format = new TextFormat();
NewgroundsAPI.normal_format.font = 'Arial';
NewgroundsAPI.normal_format.bold = true;
NewgroundsAPI.normal_format.size = 12;
NewgroundsAPI.normal_format.color = 16777215;
}
if (!NewgroundsAPI.link_format) {
NewgroundsAPI.link_format = new TextFormat();
NewgroundsAPI.link_format.color = 16776960;
NewgroundsAPI.link_format.underline = true;
}
};
v1.onNewVersionAvailable = function (version, movie_url, redirect_url) {
NewgroundsAPI.InitTextFormats();
var v2 = new Object();
v2.x = Stage.width / 2;
v2.y = Stage.height / 2;
_root.createEmptyMovieClip('NGAPI_new_version_overlay', _root.getNextHighestDepth());
_root.NGAPI_new_version_overlay.lineStyle(1, 0, 100);
_root.NGAPI_new_version_overlay.beginFill(0, 70);
_root.NGAPI_new_version_overlay.moveTo(-10, -10);
_root.NGAPI_new_version_overlay.lineTo(-10, 1000);
_root.NGAPI_new_version_overlay.lineTo(1000, 1000);
_root.NGAPI_new_version_overlay.lineTo(1000, -10);
_root.NGAPI_new_version_overlay.lineTo(-10, -10);
_root.NGAPI_new_version_overlay.endFill();
_root.NGAPI_new_version_overlay.lineStyle(10, 0, 100);
_root.NGAPI_new_version_overlay.beginFill(51);
_root.NGAPI_new_version_overlay.moveTo(v2.x - 240, v2.y - 120);
_root.NGAPI_new_version_overlay.lineTo(v2.x + 240, v2.y - 120);
_root.NGAPI_new_version_overlay.lineTo(v2.x + 240, v2.y + 80);
_root.NGAPI_new_version_overlay.lineTo(v2.x - 240, v2.y + 80);
_root.NGAPI_new_version_overlay.lineTo(v2.x - 240, v2.y - 120);
_root.NGAPI_new_version_overlay.endFill();
_root.NGAPI_new_version_overlay.createEmptyMovieClip('exit', 1000);
_root.NGAPI_new_version_overlay.exit.lineStyle(2, 39423, 100);
_root.NGAPI_new_version_overlay.exit.beginFill(0, 50);
_root.NGAPI_new_version_overlay.exit.moveTo(v2.x + 210, v2.y - 110);
_root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 230, v2.y - 110);
_root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 230, v2.y - 90);
_root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 210, v2.y - 90);
_root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 210, v2.y - 110);
_root.NGAPI_new_version_overlay.exit.endFill();
_root.NGAPI_new_version_overlay.exit.moveTo(v2.x + 214, v2.y - 106);
_root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 226, v2.y - 94);
_root.NGAPI_new_version_overlay.exit.moveTo(v2.x + 226, v2.y - 106);
_root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 214, v2.y - 94);
_root.NGAPI_new_version_overlay.exit.onMouseUp = function () {
if (_root.NGAPI_new_version_overlay.exit.hitTest(_root._xmouse, _root._ymouse)) {
_root.NGAPI_new_version_overlay.removeMovieClip();
}
};
var v3 = 'Version ' + version + ' is now available at:' + '\n';
var v5 = v3.length;
v3 += movie_url;
var v4 = v3.length;
_root.NGAPI_new_version_overlay.createTextField('mouseblocker', 99, -10, -10, 1000, 1000);
_root.NGAPI_new_version_overlay.createTextField('newversion', 100, v2.x - 210, v2.y - 90, 400, 80);
_root.NGAPI_new_version_overlay.newversion.text = 'New Version Available!';
_root.NGAPI_new_version_overlay.newversion.setTextFormat(NewgroundsAPI.header_format);
_root.NGAPI_new_version_overlay.createTextField('message', 101, (Stage.width - 400) / 2, Stage.height / 2, 400, 40);
_root.NGAPI_new_version_overlay.message.text = v3;
_root.NGAPI_new_version_overlay.message.multiline = true;
_root.NGAPI_new_version_overlay.message.wordWrap = true;
_root.NGAPI_new_version_overlay.message.html = true;
_root.NGAPI_new_version_overlay.message.setTextFormat(NewgroundsAPI.normal_format);
NewgroundsAPI.link_format.url = redirect_url;
_root.NGAPI_new_version_overlay.message.setTextFormat(v5, v4, NewgroundsAPI.link_format);
};
v1.onDenyHost = function (hostname, movie_url, redirect_url) {
NewgroundsAPI.InitTextFormats();
_root.createEmptyMovieClip('NGAPI_deny_host_overlay', _root.getNextHighestDepth());
_root.NGAPI_deny_host_overlay.lineStyle(20, 0, 100);
_root.NGAPI_deny_host_overlay.beginFill(6684672);
_root.NGAPI_deny_host_overlay.moveTo(0, 0);
_root.NGAPI_deny_host_overlay.lineTo(Stage.width, 0);
_root.NGAPI_deny_host_overlay.lineTo(Stage.width, Stage.height);
_root.NGAPI_deny_host_overlay.lineTo(0, Stage.height);
_root.NGAPI_deny_host_overlay.lineTo(0, 0);
_root.NGAPI_deny_host_overlay.endFill();
var v2 = 'This movie has not been approved for use on ' + hostname + '.';
v2 += '\r\rFor an aproved copy, please visit:\r';
var v4 = v2.length;
v2 += movie_url;
var v3 = v2.length;
_root.NGAPI_deny_host_overlay.createTextField('mousekill', 100, 0, 0, Stage.width, Stage.height);
_root.NGAPI_deny_host_overlay.createTextField('error', 101, (Stage.width - 400) / 2, Stage.height / 2 - 100, 400, 200);
_root.NGAPI_deny_host_overlay.error.text = 'ERROR!';
_root.NGAPI_deny_host_overlay.error.setTextFormat(NewgroundsAPI.error_format);
_root.NGAPI_deny_host_overlay.createTextField('message', 102, (Stage.width - 400) / 2, Stage.height / 2, 400, 200);
_root.NGAPI_deny_host_overlay.message.text = v2;
_root.NGAPI_deny_host_overlay.message.multiline = true;
_root.NGAPI_deny_host_overlay.message.wordWrap = true;
_root.NGAPI_deny_host_overlay.message.html = true;
_root.NGAPI_deny_host_overlay.message.setTextFormat(NewgroundsAPI.normal_format);
NewgroundsAPI.link_format.url = redirect_url;
_root.NGAPI_deny_host_overlay.message.setTextFormat(v4, v3, NewgroundsAPI.link_format);
};
v1.isInstalled = function () {
return true;
};
v1.onAdsApproved = function (ad_url) {};
v1.movie_options = new Object();
v1.custom_events = new Object();
v1.custom_links = new Object();
v1.MOVIE_VIEWS = 1;
v1.AUTHOR_SITE = 2;
v1.NEWGROUNDS = 3;
v1.NEW_VERSION = 4;
v1.CUSTOM_STATS = 50;
v1.GATEWAY_URL = 'http://www.ngads.com/gateway.php';
ASSetPropFlags(_global.NewgroundsAPI.prototype, null, 1);
}
#endinitclip
}